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 6 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
6 years ago

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

--Server Code

local re = game.ReplicatedStorage.RemoteEvent
local sound = script.Parent

re.OnServerEvent:Connect(function(player)
       sound:Play()
end)

--Client Code local re = game.ReplicatedStorage.RemoteEvent local button = script.Parent button.MouseButton1Down:Connect(function() re:FireServer() end)
0
thanks Asynchronize 16 — 6y
Ad

Answer this question