this is my script
1 | local tele = workspace.Teleports.SuperMan |
2 | local x = tele.Position.x |
3 | local y = tele.Position.y+ 5 |
4 | local z = tele.Position.z |
5 | script.Parent.MouseButton 1 Down:connect( function () |
6 | (Player Goes Here).HumanoidRootPart.CFrame = CFrame.new(x,y,z) |
7 | end ) |
it is inside a surface gui and it doesn't work in a local script some reason
LOL. I also had this problem a while ago, anyway... Here's the answer (it is well-commented :D):
==================================
Make a localscript in the surface GUI (NOT IN THE BUTTON). Type the following in:
01 | wait( 1 ) |
02 | script.Parent.Adornee = -- FULL LOCATION OF THE PART WHERE YOU WANT THE BUTTON TO BE -- This just makes it so it will show up on the part (you will put the surface gui in starterGUI) --- |
03 |
04 | local tele = workspace.Teleports.SuperMan |
05 | local x = tele.Position.x |
06 | local y = tele.Position.y+ 5 |
07 | local z = tele.Position.z |
08 | local player = game.Players.LocalPlayer -- Sets the localplayer |
09 |
10 | buttonnamelolidk.MouseButton 1 Down:connect( function () -- Put the full location of the button where buttonnamelolidk is |
11 | player.Character.HumanoidRootPart.CFrame = CFrame.new(x,y,z) -- Teleports the player |
12 | end ) |
Put the surface GUI in StarterGUI
** TIP: If the button still does not show, try rotating the part. **
Try puting the SurfaceGui in the StarterGui and putting the SurfaceGui's Adornee to the part of where the surfacegui was before u put it in startgui