Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why the Part not give a Cash and not destroy at PartCollector?

The Problem is Why the Part(from the Dropper)not Destroy and not give a cash if the part Destroy at the PartCollector?

script.Parent.Parent.PartCollector.Touched:Connect(function(Part)
	if Part.Touched(function(Player)
			game.Workspace.Part.Destroy:(function(Part)
				if game.Workspace.Part.Destroy:() then
					stats.Cash.Value + 10
				end
		end)
	end
end)

Fix what's wrong with this script, if you can make it :)

Thanks :)

1 answer

✓ Accepted answer

You cannot use an if statement for a function in lines 2 and 4

the destroy function cannot be used like that, either, in line 3(i don't think)

Here is a fixed script:

script.Parent.Parent.PartCollector.Touched:Connect(function(Part)
	Part.Touched:Connect(function(Player)
		game.Workspace.Part:Destroy()
		stats.Cash.Value = stats.Cash.Value + 10 -- you cannot say "stats.Cash.Value + 10"
	end)
end)

If statements: https://education.roblox.com/en-us/resources/if-then-statements

Destroy: https://developer.roblox.com/en-us/api-reference/function/Instance/Destroy

Operators: https://developer.roblox.com/en-us/articles/Operators

Hope this helps

3 comments

1

Very Thanks So Much ^w^

0

ehh, but why i not get the cash? ;-;

0

Sorry for the late reply, have you specified what "stats" is in later lines? If not, you can use game.Players:GetPlayerFromCharacter (the player variable) and access the stats from there

This discussion is preserved as it was. New answers, comments, and votes are closed.