So I am making a transformation script. When you transform it invokes an event to change your max health to a certain number. When you leave it, it reverts to your normal max health. The thing is when you transform I have it set up to set your health to your new max health and when you un transform it sets your health to your original max health. This causes players to be able to heal themselves, how would I do this. The new max health does have a certain multi from the normal max health, that multi is 10. So would it work if when they transform I multi max health by 10 and normal health by 10? and then when I leave the transformation divide it by 10?
function game.ReplicatedStorage.On:OnServerInvoke(player) wait(2) player.Character.Humanoid.MaxHealth = player.Character.Humanoid.MaxHealth * 10 player.Character.Humanoid.Health = player.Character.Humanoid.Health * 10 end end function game.ReplicatedStorage.Off:OnServerInvoke(player) wait(2) player.Character.Humanoid.MaxHealth = player.Character.Humanoid.MaxHealth / 10 player.Character.Humanoid.Health = player.Character.Humanoid.Health / 10 end
This has nothing to do with the firing the remote. Its just the script that it does that changes the characters health. I tested it and it works fine. But when they untransform the health they have goes way too low.
Ofcourse it won't fire, you have given it no reason to.
On line 1, you used 2 periods Your functions are set up wrong. They need to connect to something.
local ReplicatedStorage = game:GetService("ReplicatedStorage") ---Use GetService() local function Activate(player) wait(2) local Character = player.Character if Character then local Humanoid = Character:FindFirstChild("Humanoid") if Humanoid then Humanoid.MaxHealth = Humanoid.MaxHealth * 10 Humanoid.Health = Humanoid.Health * 10 end end end local function Deactivate(player) wait(2) local Character = player.Character if Character then local Humanoid = Character:FindFirstChild("Humanoid") if Humanoid then Humanoid.MaxHealth = Humanoid.MaxHealth / 10 Humanoid.Health = Humanoid.Health / 10 end end end ReplicatedStorage:FindFirstChild("On").OnServerInvoke:Connect(Activate) ReplicatedStorage:FindFirstChild("Off").OnServerInvoke:Connect(Deactivate)