#Teleport issue

1 messages · Page 1 of 1 (latest)

thick nimbus
#

Why doesn't my teleport button work when I press it?

#
player = game.Players.LocalPlayer
button = script.Parent
local debounce = false

function teleport()
    if not debounce then
        debounce = true
        local LowerTorso = player.Character.LowerTorso
        LowerTorso.CFrame = game.Workspace.Voetbalveldteleport.CFrame -- Change "CHANGEYOURPARTNAME" to whatever you rename your part to.
        script.Parent.Parent.Visible = false
    end
end

button.MouseButton1Click:Connect(teleport)
while true do wait()
    debounce = false
    wait(2) -- This limits to how often a player can click the teleport button (In seconds).
end```
#

This is my script I followed a youtube video cause I am new trying to make a game and learn while doing

acoustic osprey
#

PS, you should probably stop following whatever youtube video gave you this 😔

thick nimbus
thick nimbus
acoustic osprey
thick nimbus
acoustic osprey
thick nimbus
#

Ohhh tyy

novel lodgeBOT
#

studio** You are now Level 1! **studio

acoustic osprey
# thick nimbus Than this is R15 right?

It should be. But just in case, here's a version that should work with either.

player = game.Players.LocalPlayer
button = script.Parent

local teleportPart:BasePart = workspace:WaitForChild("YOURPARTSNAME") --CHANGE YOURPARTSNAME TO THE NAME OF YOUR PART

local debounce = false
local cooldown = 2

function teleport()
    if not debounce then
        debounce = true
        script.Parent.Parent.Visible = false
        
        task.delay(cooldown, function()
            debounce = false
            script.Parent.Parent.Visible = true
        end)
        
        local humanoidRootPart = player.Character:FindFirstChild("HumanoidRootPart")
        
        if not humanoidRootPart then return end
        
        humanoidRootPart.CFrame = teleportPart.CFrame
    end
end

button.MouseButton1Click:Connect(teleport)
acoustic osprey
#

Then there's definitely an issue with your setup

#

Is your part in workspace, or is it in like a model or folder in workspace

thick nimbus
#

Just in workspace

acoustic osprey
#

When trying mine, you made sure to change the "("YOURPARTSNAME")" thing right

thick nimbus
acoustic osprey
#

oh

#

I see the problem

#
local player = game.Players.LocalPlayer
local button = script.Parent

local teleportPart:BasePart = workspace:WaitForChild("YOURPARTSNAME") --CHANGE YOURPARTSNAME TO THE NAME OF YOUR PART

local debounce = false
local cooldown = 2

function teleport()
    if not debounce then
        debounce = true
        script.Parent.Parent.Visible = false
        
        task.delay(cooldown, function()
            debounce = false
            script.Parent.Parent.Visible = true
        end)
        
        local humanoidRootPart = player.Character:FindFirstChild("HumanoidRootPart")
        
        if not humanoidRootPart then return end
        
        humanoidRootPart.CFrame = teleportPart.CFrame
    end
end

button.MouseButton1Click:Connect(teleport)
#

try that

#

may have forgot the local for the player and button

#

Wait

#

that's not the problem 😔

thick nimbus
#

Oh what is I just pressed test

acoustic osprey
#

You have a breakpoint on line 27

thick nimbus
#

Whats that

#

I see that red thing yeah but what does it mean

acoustic osprey
#

right click and disable it

#

delete

#

They pause the execution of scripts for debugging purposes

thick nimbus
#

I disabled breakpoint

#

So now it must work?

acoustic osprey
#

Theoretically should

thick nimbus
#

Moment of truth

#

Atp 😢

#

I might just smash my screen

thick nimbus
acoustic osprey
thick nimbus
#

I have the button in another frame tho

novel lodgeBOT
#

studio** You are now Level 2! **studio

acoustic osprey
thick nimbus
#

So like a buttons opens GUI and that button teleports you

acoustic osprey
#

Are you pressing play or run on studio

#

I'd assume you aren't pressing run, since then you wouldn't even have a character to teleport, but like, I'm out of ideas lmao

thick nimbus
#

I have the new version

#

Let me change it to run

acoustic osprey
#

Don't change it to run 😔

#

Play is the one you want lol

thick nimbus
#

This is all

acoustic osprey
#

Keep it on test. Can you send a picture of the output?

#

After you press the button

thick nimbus
#

I can screenshare if you like

acoustic osprey
#

Am too lazy for that

thick nimbus
#

😂

acoustic osprey
#

Just a picture of the output to make sure there's no errors

thick nimbus
#

Where do I find that?

acoustic osprey
#

This is the output
If it's not already there, you can enable it in the "script" tab on the top

#

Make sure to press play and click the button before taking the picture of the output

thick nimbus
#

If I press Script i just makes a script up top

acoustic osprey
# thick nimbus

You know, I think you might have some more underlying problems than the button 💀

#

Why is there a script named "Infected" with an "infector" function lol

thick nimbus
#

Maybe stop watching youtube at all 🙏

acoustic osprey
#

I have an odd feeling that "Infected" script may, or may not be messing with the button script 😔

thick nimbus
#

My mate be using free modules 😂