So I basically my problem is When someone touches a part it gives them a Win,
But what im trying to do is make whats inside the script not happen for others
so I have a localscript
local WinEvent = game.ReplicatedStorage.Events.WinEvent
local player = game.Players.LocalPlayer
local hasPressed = false
local RestartGame = game.ReplicatedStorage.Events.RestartGame
workspace.WinPart.Touched:Connect(function(hit)
if hit.Parent:FindFirstChildOfClass("Humanoid") and hasPressed == false then
WinEvent:FireServer(player.Name)
workspace.WinPart.BrickColor = BrickColor.new("Bright green")
hasPressed = true
wait(5)
RestartGame.OnClientEvent:Connect(function()
hasPressed = false
workspace.WinPart.BrickColor = BrickColor.new("Institutional white")
end)
end
end)
and It fires the server from a serverscript:
Events.WinEvent.OnServerEvent:Connect(function(player)
player.leaderstats.Wins.Value = player.leaderstats.Wins.Value +1
end)
but when this is fired for some reason the part turns green on the server and it gives 1 win to EVERYONE in the server.
I cant seem to fix the problem.