Hello, i have this script and all players have a BoolValue inside
So i just want execute this script if BoolValue is FALSE
But its giving to me a error, can someone help?
local cd = script.Parent.ClickDetector
local pants1 = script.Parent.Parent.Parent.Char.Pants
cd.MouseClick:Connect(function(tocado)
local pants = Character:FindFirstChildOfClass("Pants")
if tocado.ReadyForHat.Value = false then
tocado.ReadyForHat.Value = true
Character.Pants.PantsTemplate = pants1.PantsTemplate
wait(30)
Character.Pants.PantsTemplate = Pantsggj.Value
tocado.ReadyforHat.Value = false
end
end
if tocado.ReadyForHat.Value = true then
end
end
local cd = script.Parent.ClickDetector
local pants1 = script.Parent.Parent.Parent.Char.Pants
cd.MouseClick:Connect(function(tocado)
local Character = tocado.Character
if not Character then return end
local pants = Character:FindFirstChildOfClass("Pants")
if tocado.ReadyForHat.Value == false then
tocado.ReadyForHat.Value = true
Character.Pants.PantsTemplate = pants1.PantsTemplate
wait(30)
Character.Pants.PantsTemplate = Pantsggj.Value
tocado.ReadyforHat.Value = false
end
end)
This should work featuring the thing @Jxl_s mentioned, and there were some unneeded ends as well, and you didn’t put a ) at the last end
Edit: I realise that you don’t have a variable for the Character, so it will error anyways. I edited my code so it will create a Chararacter variable and if it’s nil, due to the character not being made by the time the player clicks on the button, it will not continue on with the code
Anytime! I recommend you set the post that has helped you the most as the solution for anyone who may have the same problem to be able to find it easily! If you have anymore issues don’t be afraid to make another post!