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

How do I make a local script work for the server?

Asked by 7 years ago

I am trying to make a local script that when we click a button, it will change to an echo to the whole game so that everyone can here it and I cant make a textbutton work with a regular server script, so any help please?

1 answer

Log in to vote
0
Answered by
Rare_tendo 3000 Moderation Voter Community Moderator
7 years ago

If your game is FilteringEnabled, you'll need to use a RemoteEvent.

1--Server Code
2 
3local re = game.ReplicatedStorage.RemoteEvent
4local sound = script.Parent
5 
6re.OnServerEvent:Connect(function(player)
7       sound:Play()
8end)
1--Client Code
2 
3local re = game.ReplicatedStorage.RemoteEvent
4local button = script.Parent
5 
6button.MouseButton1Down:Connect(function()
7    re:FireServer()
8end)
0
thanks Asynchronize 16 — 7y
Ad

Answer this question