Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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)

1 comment

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.

2 answers

✓ Accepted answer

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)

2 comments

0

Would This Use A Local Script Or Just A Normal One?

0

Local

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.

2 comments

0

The "Teleport" method of TeleportService is callable on the Client, the error resides in the Event name.

0

oh i didnt know that nvm then

This discussion is preserved as it was. New answers, comments, and votes are closed.