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)