so I found a tutorial on YouTube on how to make a teleport GUI I tried contacting the one who made the tutorial (Gamer M8) thus, he didn't respond video link: https://www.youtube.com/watch?v=gU7qIKXQfx8 so there were 3 scripts, 1 worked, 2 didn't.
first script in StarterGui > ScreenGui > frame > local script:
for i, Button in pairs(script.Parent:GetChildren()) do if Button:IsA("TextButton") then Button.MouseButton1Click:Connect(function() game.ReplicatedStorage.TeleportEvent:FireServer((Button.Name) end) end end
second script in ServerScriptService > script:
local TeleportEvent = game.ReplicatedStorage.TeleportEvent TeleportEvent.OnServerEvent:Connect(function(Player, Position) local TeleportPoint = game.Workspace.TeleportPoints:FindFirstChild(Position) Player.Character.HumanoidRootPart.CFrame = TeleportPoint.CFrame end)
I added "RemoteEvent" in "ReplicatedStorage" before scripting anything. Then I checked the output and heres what it said:
Players.aaattas0987.PlayerGui.TeleportGui.Frame.LocalScript:6: Expected ')' (to close '(' at line 5), got 'end' - Studio - LocalScript:6
Disconnect from ::ffff:127.0.0.1|62310 - Studio
Baseplate auto-recovery file was created - Studio
it's my first time writing a script and I didn't understand what did the output mean lol, please help ????????
You forgot to put an end bracket for the Local Script in the frame: Consider adding a end bracket at the end of the line.
Solution:
for i, Button in pairs(script.Parent:GetChildren()) do if Button:IsA("TextButton") then Button.MouseButton1Click:Connect(function() game.ReplicatedStorage.TeleportEvent:FireServer(Button.Name) end) end end