Why is this not working?
local player = game.Players.LocalPlayer local name = player.ds:FindFirstChild(script.Parent.Parent.Name) while true do if player.ds:FindFirstChild(name).Value == 1 then script.Parent.BackgroundColor3 = Color3.new(16/255,134/255,46/255) wait(.1) script.Disabled = true end end
The reason it may not be working is because if the value is not 1 the loop would skip over that section that has the wait in it. This would cause an endless loop that does not wait which crashes Roblox. The following code may fix your problem or at least allow the output to show your problem. All I did was change while true do
to while wait() do
which causes the script to wait a little bit before each time it goes through the loop. This will not make any noticeable change to what the script was intended to do but does allow Roblox to run.
local player = game.Players.LocalPlayer local name = player.ds:FindFirstChild(script.Parent.Parent.Name) while wait() do if player.ds:FindFirstChild(name).Value == 1 then script.Parent.BackgroundColor3 = Color3.new(16/255,134/255,46/255) wait(.1) script.Disabled = true end end