So i wanted this script so that when you click a button a error sound will appear with an error gui but i dont know why it’s not working, (intelligence is the currency btw) basically i want to make it so if the player has lower than the amount an error will pop up and then disappear after a few seconds. Thanks anyways!
and then it just says this.
heres the script:
local player = game.Players.LocalPlayer
if player.leaderstats.intelligence.Value < 500 then
script.Parent.MouseButton1Click:Connect(function(click)
if click then
game.StarterGui.Door.ErrorFrame.Visible = true
script.Parent.error:Play()
wait(1.5)
game.StarterGui.Door.ErrorFrame.Visible = false
end
end)
end
Maybe you could try for the leaderstats to load first so it would be:
local player = game.Players.LocalPlayer intelligence = player:WaitForChild("leaderstats"):WaitForChild("intellegince") if intelligence.Value < 500 then script.Parent.MouseButton1Click:Connect(function(click) if click then game.StarterGui.Door.ErrorFrame.Visible = true script.Parent.error:Play() wait(1.5) game.StarterGui.Door.ErrorFrame.Visible = false end end) end
local player = game.Players.LocalPlayer
local leader = player:WaitForChild("leaderstats")
leader:WaitForChild("intelligence")
if player:FindFirstChild("leaderstats") then
if player.leaderstats.intelligence.Value < 500 then
script.Parent.MouseButton1Click:Connect(function(click)
if click then
game.StarterGui.Door.ErrorFrame.Visible = true
script.Parent.error:Play()
wait(1.5)
game.StarterGui.Door.ErrorFrame.Visible = false
end
end)
end
end
The issue is scripting is running before intelligence creates, so you should add waitforchild for intelligence too.
forgot to mention that this is another script, im trying to make it so if you dont have enough an error will pop up, but if u do have enough a door will open.