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

I used the Remote Event, but it did not work, can anyone check if I wrote it correct?

Asked by 5 years ago
Edited 5 years ago

Gui local script

script.Parent.MouseButton1Click:Connect(function()
    game.ReplicatedStorage.RemoteEvent:FireServer()
end)

script

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function()
    -- Any code in here will run when RemoteEvent is triggered
    script.Parent.MouseButton1Click:connect(function()
    game.StarterGui.Teleport.Frame.Visible = true
end)
end)
0
Is FE enabled MaxDev_BE 55 — 5y

2 answers

Log in to vote
1
Answered by 5 years ago

As seith14 said, place the LocalScript inside the TextButton that is in your StarterGui. Instead of using game.Players try using script.Parent.

script.Parent.MouseButton1Click:Connect(function() --This is where your TextButton is.
    script.Parent.Frame.Visible = true  --This is where your frame is.
end)

Use more Connect with "C" because with "c" this is obsoleto.

Try to check the locations to see if they are correct and please put the error the next time you read the post, thanks!

Ad
Log in to vote
0
Answered by
seith14 206 Moderation Voter
5 years ago
Edited 5 years ago

You don't need a remoteevent for this because it doesn't need to access the server. Make sure you have this in a LocalScript

script.Parent.MouseButton1Click:connect(function()
    game.Players.LocalPlayer.PlayerGui.Teleport.Frame.Visible = true
end)
0
ummm does not seem to be working RainbowBeastYT 85 — 5y

Answer this question