Hi guys, I've been making some scripts for a friend of mine but when he tests them, he keeps having to revert back to the previous update because some of the local scripts in my GUI keep breaking.
My friend had made a double jump script and I had made a "powerup" button for the GUI. These two things are local scripts and my friend reckons they're conflicting each other.
I have pretty much tried everything to get these to stop breaking but they still persist to break after I die once. They work fine before your first death. After that, they don't work anymore.
The strangest thing is that if I test it by playing solo or using player/server mode, they all work fine and keep working after death.
So, I'm completely stumped so I came here to find some answers. Why do these local scripts keep breaking after I die?
Base "powerup" button local script: (It had been one script earlier and I assumed the scripts broke on death because it was a script and I had tried to make it "too efficient")
wait(1) --Tried a delay to see if that would fix anything.
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:wait()
local db = script.Parent.Parent:WaitForChild("Disable")
local select = db.Parent:WaitForChild("Select")
local hum = char:WaitForChild("Humanoid")
function clickFunction()
if char:FindFirstChild("ForceField") then
char.ForceField:Destroy()
else
Instance.new("ForceField",char)
end
end
script.Parent.MouseButton1Click:connect(function()
if db.Value == true then return end
db.Value = true
select:Play()
clickFunction()
wait(.5)
db.Value = false
end)
Double jump local script (in StarterPack and was edited by my friend, so it may be a bit inefficient):
repeat wait() until game:GetService("Players")
local Player = game.Players.LocalPlayer
repeat wait() until Player
repeat wait() until Player.Character and Player.Character.Humanoid
local FirstJump = false
local MidJump = false
local Mouse = Player:GetMouse()
TING = false
function onKeyDown(key)
if string.byte(key) == 32 and FirstJump == true and not TING and (MidJump == false or script.Creative.Value == true) then
TING = true
MidJump = true
Player.Character.Torso.Velocity = Player.Character.Torso.Velocity + Vector3.new(0,100,0)
wait(0.1)
TING = false
end
end
function Update()
if Player.Character.Humanoid.Jump == true then
FirstJump = true
else
FirstJump = false
MidJump = false
end
end
Mouse.KeyDown:connect(onKeyDown)
Player.Character.Humanoid.Changed:connect(Update)
Any help is appreciated, thanks!

2 comments
Any errors in the output?
No errors in output. Probably because of the WaitForChild methods I've been using.