*sneakily combines two above codeblocks*
Put this in a LocalScript
local box = script.Parent
local plr = game:GetService("Players").LocalPlayer
local event = game:GetService("ReplicatedStorage"):WaitForChild("HealEvent")
box:GetPropertyChangedSignal('Text'):Connect(function()
if box.Text == "health" then
event:FireServer()
end
end)
Put this in a Script
local event = game:GetService("ReplicatedStorage"):WaitForChild("HealEvent")
event.OnServerEvent:Connect(function(player)
player.Character.Health = player.Character.MaxHealth
end)
Make a RemoteEvent called HealEvent and put it in ReplicatedStorage.
Explanation coming later
1 comment
place the wait() outiside of the if