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)
Huh... My post didn't post.
So the problem most likely is that you declared player before player actually fully loaded.
It's a common error with local scripts in PlayerGui or Backpack that defines player at the top.
What you do is just add this one-liner to the top:
repeat wait() until game.Players.LocalPlayer
Tell us what happens now.
[ DID NOT WORK ]
Wait a minute, I think I figured it out. The
function onClicked() Heal() end button.MouseButton1Click:connect(onClicked)
is above the actual function it's self (Heal()). So if I just use the updated script rather than the original, it should work, am I correct?
Sadly, this did not work. I still need help. :c