Hello , i’ve made a collect script for my team , and it’s not working
orb = 0
if script.Parent.orb1.ProximityPrompt.Triggered:Connect(function()
script.Parent.orb1:Destroy()
orb += 1
end) then
end
if script.Parent.orb2.ProximityPrompt.Triggered:Connect(function()
script.Parent.orb2:Destroy()
orb += 1
end) then
end
if script.Parent.orb3.ProximityPrompt.Triggered:Connect(function()
script.Parent.orb3:Destroy()
orb += 1
end) then
end
if script.Parent.orb4.ProximityPrompt.Triggered:Connect(function()
script.Parent.orb4:Destroy()
orb += 1
end) then
end
if orb>=4 then
print("ayoo bro")
end
In fact , it does destroy the parts , but not printing.
Not sure what the problem is
I don’t know what’s going on with the functions but they should be like this(try this script):
orb = 0
script.Parent.orb1.ProximityPrompt.Triggered:Connect(function()
script.Parent.orb1:Destroy()
orb += 1
end)
script.Parent.orb2.ProximityPrompt.Triggered:Connect(function()
script.Parent.orb2:Destroy()
orb += 1
end)
script.Parent.orb3.ProximityPrompt.Triggered:Connect(function()
script.Parent.orb3:Destroy()
orb += 1
end)
script.Parent.orb4.ProximityPrompt.Triggered:Connect(function()
script.Parent.orb4:Destroy()
orb += 1
end)
if orb>=4 then
print("ayoo bro")
end
btw, you should keep the output open to see errors
Yeah I know , it just put line in the “ends” when I do that
That didn’t change anything tho. No errors
Do you have the output open. There must be an error.
Where is the script located and is it local or server
My orbs are located in a folder , and the script too
Sorry, I read it wrong. I thought this said it “doesn’t” the reason it is not printing is because it only checks once. Try this:
orb = 0
if script.Parent.orb1.ProximityPrompt.Triggered:Connect(function()
script.Parent.orb1:Destroy()
orb += 1
end) then
end
if script.Parent.orb2.ProximityPrompt.Triggered:Connect(function()
script.Parent.orb2:Destroy()
orb += 1
end) then
end
if script.Parent.orb3.ProximityPrompt.Triggered:Connect(function()
script.Parent.orb3:Destroy()
orb += 1
end) then
end
if script.Parent.orb4.ProximityPrompt.Triggered:Connect(function()
script.Parent.orb4:Destroy()
orb += 1
end) then
end
while task.wait(1) do
if orb>=4 then
print("ayoo bro")
end
end