This script is used in hudzell's Parkour Battles as a healing script
-- UPDATE, SCROLL DOWN --
What is wrong with this LocalScript that makes it work properly only in solo mode but acts like it's a button with no script in multiplayer?
local button = script.Parent
player = game.Players.LocalPlayer
character = game.Players.LocalPlayer.Character
local Blur = script.Parent.Parent.Blur
function onClicked()
Heal()
end
button.MouseButton1Click:connect(onClicked)
function Heal()
if script.Parent.Text == "Heal" then
script.Walkspeed.Value = character.Humanoid.WalkSpeed
character.Humanoid.WalkSpeed = 0
Blur.Visible = true
Blur.BackgroundTransparency = .5
local healFire = script.HealFire:Clone()
local healLight = script.HealLight:Clone()
local healSparkles = script.HealSparkles:Clone()
healLight.Parent = character.Torso
healFire.Parent = character.Torso
healSparkles.Parent = character.Torso
for i = 1, 100 do
local newHealth = character.Humanoid.Health + 2
if newHealth < 100 then
wait(.001)
character.Humanoid.Health = newHealth
else
character.Humanoid.Health = character.Humanoid.MaxHealth
end
end
Blur.Visible = false
Blur.BackgroundTransparency = 1
healFire.Enabled = false
healLight.Enabled = false
healSparkles.Enabled = false
character.Humanoid.WalkSpeed = script.Walkspeed.Value
button.Text = "Wait: 5"
wait(1)
button.Text = "Wait: 4"
wait(1)
button.Text = "Wait: 3"
wait(1)
button.Text = "Wait: 2"
wait(1)
button.Text = "Wait: 1"
wait(1)
healFire:remove()
healLight:remove()
healSparkles:remove()
button.Text = "Heal"
end
end
Update: I changed the script a little at the top
local button = script.Parent
player = game.Players.LocalPlayer
character = game.Players.LocalPlayer.Character
local Blur = script.Parent.Parent.Blur
script.Parent.MouseButton1Down:connect(function()
if script.Parent.Text == "Heal" then
script.Walkspeed.Value = character.Humanoid.WalkSpeed
character.Humanoid.WalkSpeed = 0
Blur.Visible = true
Blur.BackgroundTransparency = .5
local healFire = script.HealFire:Clone()
local healLight = script.HealLight:Clone()
local healSparkles = script.HealSparkles:Clone()
healLight.Parent = character.Torso
healFire.Parent = character.Torso
healSparkles.Parent = character.Torso
for i = 1, 100 do
local newHealth = character.Humanoid.Health + 2
if newHealth < 100 then
wait(.001)
character.Humanoid.Health = newHealth
else
character.Humanoid.Health = character.Humanoid.MaxHealth
end
end
Blur.Visible = false
Blur.BackgroundTransparency = 1
healFire.Enabled = false
healLight.Enabled = false
healSparkles.Enabled = false
character.Humanoid.WalkSpeed = script.Walkspeed.Value
button.Text = "Wait: 5"
wait(1)
button.Text = "Wait: 4"
wait(1)
button.Text = "Wait: 3"
wait(1)
button.Text = "Wait: 2"
wait(1)
button.Text = "Wait: 1"
wait(1)
healFire:remove()
healLight:remove()
healSparkles:remove()
button.Text = "Heal"
end
end)

4 comments
Is this a LocalScript? What is it supposed to do that it is not doing?
It's not doing anything in multiplayer, it acts like it's a button with no script in it. But in solo mode it works perfectly.
Does anyone know a place output GUI that I can use? I might be able to figure it out if I can find one.
Wow, thank you so much Bebee2, it worked! :D