So I have a GUI & a Remote Event. Whenever you click a button it should get the text of a text box pass it as a perimeter and fire an event that should change your leaderstats value of honor to honor.Value = honor.Value + 1 but doesn't seem to be working.
Local Script Script Inside of the GUI:
local Name = script.Parent:WaitForChild("Name")
local HonorButton = script.Parent:WaitForChild("HonorButton")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Player
local Event
HonorButton.MouseButton1Click:Connect(function()
Event = ReplicatedStorage:FindFirstChild("EN1")
if Event ~= nil then
Player = Name.Text
wait(1)
Event:FireServer(Player)
end
end)
Server Script Script inside of the Remote Event:
script.Parent.OnServerEvent:Connect(function(Player)
for _,v in pairs(game.Players:GetPlayers()) do
if v.Name == Player then
if Player.leaderstats then
Player.leaderstats["Honor"].Value = Player.leaderstats["Honor"].Value + 1
end
end
end
end)

6 comments
Why do you have a script inside of a RemoteEvent? Also, RemoteEvents automatically pass the player who called them. You should be catching (player Instance, playerName String).
I have a script inside a Remote Event because I want a script inside a Remote Event.
Also, do you mean sometime like this in the Remote Event Script "script.Parent.OnServerEvent:Connect(function(called,Player)"
Yeah, I'm pretty sure that in your server script Player is representing the player instance of the player who called it - not the string you are passing.
Still doesn't work.
scripts don't run in replicatedstorage