Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My Text Button Gui That Sends The Player To Another Game Will Not Work?

Asked by 3 years ago

Whenever I Click On This, It Doesn't Do Anything. It Runs On A Local Script, But Ive Tried Running It On A Normal Script But It Wont Work.

script.Parent.MouseButton1:Connect(function()
    game:GetService("TeleportService"):Teleport(game.Players.LocalPlayer,6317944962)
end)

Also It Would Be Nice To Know If You Can Change The GUI To Not Be "Typeable" (Users Can Type And Change The Text)

0
The correct RBXScriptSignal is "MouseButton1Click". Make sure to enable the Output widget in Studio to see the errors generated from your program; if you've already done this, please include it in your posts from hereon out. Ziffixture 6913 — 3y

2 answers

Log in to vote
1
Answered by 3 years ago
Edited 3 years ago

You made 1 small error, you should be using MouseButton1Click or MouseButton1Down, and you dont need to call the player

script.Parent.MouseButton1Down:Connect(function()
      game:GetService("TeleportService"):Teleport(000000) -- your game id here
end)
0
Would This Use A Local Script Or Just A Normal One? ricelicker 52 — 3y
0
Local KronxGoat 50 — 3y
Ad
Log in to vote
-1
Answered by 3 years ago

You have to fire a remote function from the local script. Make a remote event and store it in ReplicatedStorage.

--local script
local remoteEvent = game.ReplicatedStorage.RemoteEvent

script.Parent.MouseButton1:Connect(function()
    remoteEvent:FireServer(631794) --fire the script with the id as a parameter
end)


--server script
local remoteEvent = game.ReplicatedStorage.RemoteEvent

remoteEvent.OnServerEvent:Connect(function(plr, id) --receives player and id
     game:GetService("TeleportService"):Teleport(plr,6317944962)
end)

Untested code, let me know if you run into any issues.

0
The "Teleport" method of TeleportService is callable on the Client, the error resides in the Event name. Ziffixture 6913 — 3y
0
oh i didnt know that nvm then LeedleLeeRocket 1257 — 3y

Answer this question