local prompt = script.Parent.Parent:WaitForChild("DrivePrompt")
while true do
print(script.Parent.Parent.Locked.Value)
if script.Parent.Parent.Locked.Value == false then
prompt.Enabled = true
else
prompt.Enabled = false
end
wait(0.001)
end
When i check the boolvalue to true it’s still print false
even i tried to make it true by using command workspace.RealingZeeKungsCar.Locked.Value = true still not working
any help please?
By the way, this is a tangent but you can do this much more efficiently using Roblox Signals
local prompt = script.Parent.Parent:WaitForChild("DrivePrompt")
local locked = script.Parent.Parent.Locked
prompt.Enabled = locked.Value
locked.Changed:Connect(function()
prompt.Enabled = locked.Value
end)
What this does is registers an “Event” for when the value of Locked changes, and then only runs your code when that happens. This means you don’t have to constantly check
local car = script.Parent.Parent
local prompt = car:WaitForChild("DrivePrompt")
local locked = car:WaitForChild("Locked")
prompt.Enabled = not locked.Value
locked.Changed:Connect(function(newVal)
print(newVal)
prompt.Enabled = not newVal
end)
Because in his code, if Locked is false then the prompt enables, and vice versa, so you need to use not