my serverscrpt:
script.Parent.PointsRemoteEvent.OnServerEvent:Connect(function(plr, Number)
local Int = tonumber(Number)
plr.leaderstats.Points.Value = Int
end)
local script:
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.PointsRemoteEvent:FireServer(script.Parent:FindFirstAncestorOfClass("Player"), script.Parent.Parent.PointsBox.Text)
end)
but when i click it the buttuon that fires the event, my Points is changed to 0.
You don’t need to include the Player when using FireServer, it’s automatically sent so use it like this:
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.PointsRemoteEvent:FireServer(script.Parent.Parent.PointsBox.Text)
end)
one more thing, what is player?, what is player who fired the event?
event is fired by scripts?
Yes, the player who fired the event is automatically sent to the receiving event.
no, i mean who is the player who fired the event? who player will be sent?
The event is fired from a LocalScript so the server will know who the player is from where it was sent from.