hey guys, i am new to scripting and i am trying to figure out why my script is not working.
the goal of the script is supposed to: check if the player has a job in the store that they are in, if they have a job you are allowed to help the customer, if not then the customer will deny your assistance.
problem: the script COMPLETELY ingnores the entire first half of the script, even though the "working" value IS true, it does not work. it skips to the second half of the script, thinking the value is not true. anyone know why? here's the script:
local ms = script.Parent["Right Arm"].ClickDetector
function onClick(playerClicked)
if playerClicked.working.Value == true then
local clonems = script.Parent:Clone()
clonems.Parent = game.ReplicatedStorage
playerClicked.leaderstats.Money.Value = playerClicked.leaderstats.Money.Value+10
script.Parent.Name = "Thanks for helping me!"
wait(3)
for _, children in pairs (script.Parent:GetChildren()) do
if children:IsA("Part") then
children:Destroy()
end
end
wait(30)
clonems.Parent = workspace
wait(1)
script.Parent:Destroy()
end
----------------
if playerClicked.working.Value == false then
script.Parent.Name = "You can't help me! You don't work here."
wait(3)
script.Parent.Name = "Help Customer"
end
end
ms.MouseClick:Connect(onClick)
