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

Im making a tycoon game and the dropper part doesnt destroy nor give cash value, how do i fix it?

Ive looked thru the code myself and everything looked fine but the script isnt working

local CashValue = script.Parent.Parent.Parent.Parent.Values.CashValue

script.Parent.Touched:Connect(function(hit)
	if hit.Name == "Part" and hit:FindFirstChild("CashValue") then
		CashValue.Value += hit:FindFirstChild("CashValue").Value
		hit:Destroy()
	end
end)

7 comments

0

is this a local script and are you sure that CashValue can be found and is the part name Part?

0

it is not a localscript and the parts name is part

0

where is this script?

0

MainItems Folder

0

Hey there puppy, the script you recommended didnt work. Can you think of something else?

0

then are you spawning the block in a local script?

0

no

1 answer

In the part where the parts goes in, this script should work

local CashValue = workspace.Tycoon.CashValue
script.Parent.Touched:Connect(function(hit)
       if hit:FindFirstChild("CashValue") then --make sure its a part to sell idk how to say it lol
               local Value = hit:FindFirstChild("CashValue").Value
               CashValue.Value += Value --assuming CashValue is in workspace
               hit:Destroy()
        end
end)

1 comment

0

That script didnt work

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