I made a Surface gui inside a part and then made a TextButton inside it because that's how part gui's work. Anyways I placed the script that always worked in normal StarterGui GUI's but it isn't working inside a part gui. Can you help me please?
local debounce = true
local player = game.Players.LocalPlayer -- The player
local target = game.Workspace:WaitForChild("Practiceobby") --Part that player will get teleported to.
script.Parent.MouseButton1Click:Connect(function()
if debounce == true then
debounce=true
script.Parent.ClickSound:Play()
player.Character.HumanoidRootPart.CFrame = target.CFrame*CFrame.new(0,3,0)
-- Teleporting the player... but doesn't work ):
debounce = true
end
end)
Type of script is a LocalScript
More Info
game.Workspace.Part.SurfaceGui.TextButton.LocalScript

3 comments
Also you might want to change it to a regular script
ok
LocalScripts don't run in Workspace.