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

?I am trying to make a tycoon clone But the if statement is ignored.

When i make the dropper clone it keeps cloning in the same place.

And it makes ALOT of droppers and the if statement is completely ignored. I am looking for help with that issue and i don't know why the statement is ignored

script.Parent.Touched:Connect(function(hit)
		if hit.Parent:findFirstChild("Humanoid") then
			local price = script.Parent.Parent.Script.price
			local itemname = script.Parent.Parent.Script.itemname
			local playername = hit.Parent.Name
			local currencyName = script.Parent.CurrencyName
			local tt = 0.1
			local player = game.Players:FindFirstChild(playername)
			local disabled = false
			
			
			print(playername)
			local function Negate()
				
				local dropper = game.ServerStorage:FindFirstChild(script.item_name.Value)
				
				if disabled == false then
					script.Parent.Transparency = 1
					script.Parent.Parent.Part.Transparency = 1
					script.Parent.Parent.BillboardGui.TextBox.Visible = false
					local debounce = false
					if  disabled == false and dropper and debounce == false then
						local d = dropper:Clone()
						d.Parent = workspace
						disabled = true
						debounce = true
					end
					
					disabled = true
					print(disabled)
					
				end
			end
			Negate()
			
		end
end)

7 comments

0

Lighting should NOT be used as storage, and clone is deprecated use Clone

0

Is "item_name" an ObjectValue?

0

@Naxxanar No it is not

0

Could you tell me what it is?

0

Actually, my bad. That doesn't seem to be the problem. We need more of your code to resolve your issue.

0

I have published all the code but for some reason the top isnt formatted

0

Put the ENTIRE script in between the ~~~~~ and ~~~~~. I think with the entire script some of us could help you.

1 answer

I managed to make a temporary workaround by putting the actual button in serverstorage but i don't really recommend people to do it.

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