Here is my localscript
player = game.Players.LocalPlayer function addChar() wait(0.1) player.Character.Humanoid.MaxHealth = player.Character.Humanoid.MaxHealth+(2*Str)+(4*Vit) player.Character.Humanoid.Health = player.Character.Humanoid.MaxHealth script.Parent.Parent.Information.HP.Text = "HP: " .. tostring(player.Character.Humanoid.MaxHealth) script.Parent.Parent.Information.MP.Text = "MP: " .. tostring((player.Stats.Intelligence.Value*4)+100) script.Parent.Parent.Information.ATKSpeed.Text = "ATKSpeed: " .. tostring(Speed) script.Parent.Parent.Information.ATKDMG.Text = "ATKDMG: " .. tostring(Damage) script.Parent.Parent.Information.Stamina.Text = "Stamina: " .. tostring(player.PlayerGui.mainUI.statHolder.staminaHolder.staminaBar.MaxStamina.Value) script.Parent.Parent.Information.CRITCHANCE.Text = "Critical %: " .. tostring(Critical) .. "%" script.Parent.Parent.Information.CRITDMG.Text = "Critical DMG: " .. tostring(CriticalDamage) script.Parent.Parent.Information.Evasion.Text = "Evasion%: " .. tostring(player.Stats.Dexterity.Value/5) .. "%" script.Parent.Parent.Information.SprintSpeed.Text = "Sprint Speed: " .. tostring(player.Stats.Agility.Value+26) end player.CharacterAdded:Connect(function() game.ReplicatedStorage.RemoteEvents.CharacterAdded:FireServer(player) end) player.Equip.ChildAdded:Connect(function() game.ReplicatedStorage.RemoteEvents.StatChange:FireServer(player, "Strength") end) player.Equip.ChildRemoved:Connect(function() game.ReplicatedStorage.RemoteEvents.StatChange:FireServer(player, "Strength") end) player.Stats.Strength.Changed:Connect(function() game.ReplicatedStorage.RemoteEvents.StatChange:FireServer(player, "Strength") end) player.Stats.Agility.Changed:Connect(function() game.ReplicatedStorage.RemoteEvents.StatChange:FireServer(player, "Agility") end) player.Stats.Intelligence.Changed:Connect(function() game.ReplicatedStorage.RemoteEvents.StatChange:FireServer(player, "Intelligence") end) player.Stats.Defense.Changed:Connect(function() game.ReplicatedStorage.RemoteEvents.StatChange:FireServer(player, "Defense") end) player.Stats.Vitality.Changed:Connect(function() game.ReplicatedStorage.RemoteEvents.StatChange:FireServer(player, "Vitality") end) player.Stats.Dexterity.Changed:Connect(function() game.ReplicatedStorage.RemoteEvents.StatChange:FireServer(player, "Dexterity") end)
my server script:
game.ReplicatedStorage.RemoteEvents.StatChange.OnServerEvent:connect( function(player, x) wait(0.03) print(x) local Str = player.Stats.Strength.Value local Agi = player.Stats.Agility.Value local Int = player.Stats.Intelligence.Value local Def = player.Stats.Defense.Value local Vit = player.Stats.Vitality.Value local Dex = player.Stats.Dexterity.Value local Damage = 0 local Speed = 0 local Critical = 0 local CriticalDamage = 0 local weapon for j,k in pairs(player.Equip:GetChildren()) do if k.itemType.Value == "Weapon" then Damage = k.itemDamage.Value Speed = k.itemSpeed.Value Critical = k.itemCritical.Value CriticalDamage = k.itemCritDamage.Value weapon = k player.PlayerGui.statsGUI.Main.Information.ATKDMG.Text = "ATKDMG: " .. tostring(Damage) player.PlayerGui.statsGUI.Main.Information.CRITCHANCE.Text = "Critical %: " .. tostring(Critical) .. "%" player.PlayerGui.statsGUI.Main.Information.CRITDMG.Text = "Critical DMG: " .. tostring(CriticalDamage) end end if weapon == nil then Damage = 0 Speed = 0 Critical = 0 CriticalDamage = 0 player.PlayerGui.statsGUI.Main.Information.ATKDMG.Text = "ATKDMG: " .. tostring(Damage) end --Health-- if x == "Strength" then player.Character.Humanoid.MaxHealth = player.Character.Humanoid.MaxHealth+2 player.PlayerGui.statsGUI.Main.Information.HP.Text = "HP: " .. tostring(player.Character.Humanoid.MaxHealth) player.PlayerGui.statsGUI.Main.Information.ATKDMG.Text = "ATKDMG: " .. tostring(Damage) end print("Lmao") if x == "Agility" then player.PlayerGui.statsGUI.Main.Information.ATKSpeed.Text = "ATKSpeed: " .. tostring(Speed) player.PlayerGui.statsGUI.Main.Information.SprintSpeed.Text = "Sprint Speed: " .. tostring(player.Stats.Agility.Value+26) end if x == "Intelligence" then player.PlayerGui.statsGUI.Main.Information.MP.Text = "MP: " .. tostring((player.Stats.Intelligence.Value*4)+100) end if x == "Defense" then player.PlayerGui.statsGUI.Main.Information.damageResistance.Text = "DMG Resist%: " .. tostring(player.Stats.Defense.Value/5) .. "%" end if x == "Vitality" then player.Character.Humanoid.MaxHealth = player.Character.Humanoid.MaxHealth+4 player.PlayerGui.statsGUI.Main.Information.HP.Text = "HP: " .. tostring(player.Character.Humanoid.MaxHealth) player.PlayerGui.statsGUI.Main.Information.Stamina.Text = "Stamina: " .. tostring(player.PlayerGui.mainUI.statHolder.staminaHolder.staminaBar.MaxStamina.Value) end if x == "Dexterity" then player.PlayerGui.statsGUI.Main.Information.CRITCHANCE.Text = "Critical %: " .. tostring(Critical) .. "%" player.PlayerGui.statsGUI.Main.Information.CRITDMG.Text = "Critical DMG: " .. tostring(CriticalDamage) player.PlayerGui.statsGUI.Main.Information.Evasion.Text = "Evasion%: " .. tostring(player.Stats.Dexterity.Value/5) .. "%" end end)
it prints x as my player name?
If you want to pass a variable parameter to from your local script to your server script using a Remote Event, you need to do this:
Local Script:
game.ReplicatedStorage.RemoteEvents.StatChange:FireServer(VariableYouWantToPass)
Server Script:
game.ReplicatedStorage.RemoteEvents.StatChange.OnServerEvent:connect( function(player, x) -- Your code end)
In this case whatever variable you want to pass from your local script will be viewed as "x" in your server script