Proximity Prompt is supposed to teleport player, but it won't do anything

Hi I am having a problem when I click the proximity prompt it is supposed to teleport you. issue i’m having is when I click it nothing happens
script:

disabled = false

script.Parent.Proximityprompt.Triggered:connect(function()

    if disabled == false then

        disabled = true

        game.Workspace.Teleport.RemoteFunction:InvokeServer()

        wait(.2)

        disabled = false
        end
        end)

if the proximity prompt script to open the gui is on the server it wont know when the client closes the script and still thinks the gui is still open and doesnt change the visibility.

if you want to keep it on the server just set the visibility to false first then to true, if you want it on the client you either create a remote to open the gui or handle the prompt on the client

1 Like

Hi I decided to scrap the idea instead of a gui when you click the proximity prompt it will teleport you. issue i’m having now is when I click it nothing happens
script:

disabled = false

script.Parent.Proximityprompt.Triggered:connect(function()

    if disabled == false then

        disabled = true

        game.Workspace.Teleport.RemoteFunction:InvokeServer()

        wait(.2)

        disabled = false
        end
        wait(.2)

        script.Parent.BBRo:Connect(function() --[[ i will remove this part--]]

            script.Parent.BBRo = workspace
    end)

end)

I’m assuming this script is a Script object inside the proximity prompt’s parent so the reason why it doesnt work might be because InvokeServer is only used when communicating across the Client-Server boundary. In your case, youre trying to communicate Server-Server. If you want to communicate from one Script to the other, use Bindable Events instead :slight_smile:

also if you’re teleporting the player, you could just put the teleporting script inside the function, up to you

1 Like

i’m using a local script inside the part where the proximity prompt is

1 Like

uhh I don’t think that will work. use serverside script instead

the problem with using a localscript is that unless it is parented to the client (player), it will not run (i think)

1 Like

I changed it to a normal script. I don’t know what a serverside script is? It still didn’t work :sleepy: The error comes up on the line where it says game.Workspace.Teleport.RemoteFunction:InvokeSever()
I got the Remotefunction in a folder with the teleport system is.

serverside script is just a normal script

InvokeServer wont work when you use it in a normal script. When the RemoteFunction fires, if you are doing something on the client, use a RemoteEvent and use FireClient. If you are doing something on another script, use a BindableEvent

2 Likes

Alright I will try that sometime later today – Thanks :grinning:

Hi thanks for your help, sadly it didn’t work :neutral_face: I might’ve did something wrong. I did figure it out anyways by doing this: Instead I made a part with a proximityprompt inside a script.
Script:

local Proximityprompt = script.Parent
ProximityPrompt.Triggered:Connect(function(player)
player.Character.HumanoidRootPart.Position = workspace.PartNameToTeleportTo.Position

Then I made another part and named it to PartNameToTeleportTo

Thanks for everyone’s help :smiley:

1 Like