When scripting with Guis, you should use a localscript. For FilteringEnabled Client-to-Server communication (basically, a player's computer sending a message to the server), you should use RemoteEvents. I'll show you an example. Lets say you have a RemoteEvent in game.ReplicatedStorage. This example has a button that, when clicked, adds a part to the workspace.
local Button = script.Parent
local Remote = game.ReplicatedStorage:WaitForChild('RemoteEvent')
Button.MouseButton1Click:Connect(function()
Remote:FireServer()
end)
local Remote = game.ReplicatedStorage:WaitForChild('RemoteEvent')
Remote.OnServerEvent:Connect(function(Player)
local Part = Instance.new('Part', workspace)
print(Player.Name .. ' added a part to the workspace!')
end)
When doing something that ALL players should see, use a server script (aka a Script).
When doing something that only ONE player should see, use a local script.
LocalScripts should be in a Player's PlayerScripts, PlayerGui, a Tool, or a Player's Character. Hope this helped..
2 comments
I placed the script into a local script and it didn't work
dude your supposed to edit the script above it doesnt even have to do your script right now...