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

Why my teleport textbutton wont work in online mode. What's wrong with my script?

I created a button for the game. So you will teleport when the button is pressed, it works in ROBLOX Studio, but it won't work in ONLINE mode. I already know that I used:


local player = game.Player.LocalPlayer


-- I dont know how else to use cause this wont work else:



player = script.Parent.Parent.Parent.Parent


-- or this:


function PlayerClicked(player)
local pos = game.Workspace.Exitpart
player.Character:moveTo(pos.Position)
end
script.Parent.MouseButton1Clicked:connect(PlayerClicked)



-- So my general script that I used is this one:

local player = game.Players.LocalPlayer
local character = player.Character

script.Parent.MouseButton1Click:connect(function()
	local pos = game.Workspace.ExitPart
	character:moveTo(pos.Position)
	script.Parent.Parent.Enabled = false
end)

Sorry if you didn't understanded lua selection of my message content, but it didn't allowed me to add more lua slections cause it glitches the message....

It won't work. if you need more information please send a request in the comments and I will add more info. Please help!

2 comments

0

is filtering enabled on?

0

by the way, line 8 can be simplified with: script:FindFirstAncestorOfClass("Player") because im assuming the gui is located in the players service

1 answer

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