I have it in a button, it works perfectly fine in studio but doesnt in game. There's no errors either.
local Player = script.Parent.Parent.Parent local Humanoid = Player.Character.Humanoid local value = "Power" script.Parent.Train.MouseButton1Click:Connect(function() wait(1) Player.leaderstats[value].Value = Player.leaderstats[value].Value + 1 local health = Humanoid.Health local power = Player.leaderstats[value].Value local newhealth = health*power Humanoid.MaxHealth = newhealth end)
Try this! (LOCALSCRIPT)
local Player = game:GetService("Players").LocalPlayer local Humanoid = Player.Character:WaitForChild("Humanoid") local Power = Player:FindFirstChild("leaderstats"):WaitForChild("Power") script.Parent.Train.MouseButton1Click:Connect(function() Power.Value = Power.Value +1 Humanoid.MaxHealth = Humanoid.Health*Power.Value end)
Try putting that code into a local script (if it isn't already in one) and if it doesn't work while in a local script then go off of what CPF2 said. You can read up on Remote Events here: https://wiki.roblox.com/index.php?title=Remote_Functions_%26_Events