Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Can Someone Help Me With This Teleport GUI? it's my first time WRITING a script..

Asked by 2 years ago
Edited by Xapelize 2 years ago

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 ????????

1 answer

Log in to vote
0
Answered by
Xapelize 2658 Moderation Voter Community Moderator
2 years ago
Edited by imKirda 2 years ago

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
0
TYSM!!!! you're a life saver???????????????????????? aaattas0987 6 — 2y
0
go to sleep @Yapelize imKirda 4491 — 2y
0
no Xapelize 2658 — 2y
0
wth ???? aaattas0987 6 — 2y
Ad

Answer this question