uh I need help with this script it is basically where it checks where the bool value is true i tried to put a while loop but i dont work, pls help, here is the code:
local hasQuest = script.Parent.HasQuest local event = game.ReplicatedStorage.Events.NoQuest script.Parent.Touched:Connect(function(hit) while true do wait(1) local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player then if hasQuest.Value == false then event:FireClient(player) else script.Parent.CanCollide = false wait(2) script.Parent.CanCollide = true end end end end)
ANSWER: GetPropertyChangedSignal. You can use this to make code run when the hasQuest.Value
changes.
How:
hasQuest:GetPropertyChangedSignal("Value"):Connect(function() if hasQuest.Value == true then -- do something else -- do something end end)
Note: keep in mind, this code will run everytime
hasQuest
's value changes.
local hasQuest = script.Parent.HasQuest local debounce = true script.Parent.Touched:Connect(function(hit) local h = hit.Parent:FindFirstChild("Humanoid") if h~=nil then if debounce then debounce = false if hasQuest.Value == false then print("sdkajuhasdkjhdsakjhasdkjasdhkasjdhdsakjdsakjhdsa") else script.Parent.CanCollide = false wait(2) script.Parent.CanCollide = true end wait(2) debounce = true end end end)
here you can try this, i chaged the remote thing to print so i could make sure it works, you should know what to put instead.