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

Mouse Click a userdata value?

Ok so Im trying to make a tycoon how can I make it that when a player presses this button parts drop from where I told them to well everytime I try this How could I fix this?

script.Parent.ClickDetector.MouseClick(function()
	local DropperFree = game.Workspace.Dropper1.Dropper
	local newParts = Instance.new("Part")
	newParts.Name = "Drops"
	newParts.Parent = game.Workspace
	newParts.Position = DropperFree.Position
	
	
	
	
	
	
	
end)

it gives me in output Workspace.Part.Script:1: attempt to call field 'MouseClick' (a userdata value)

1 answer

✓ Accepted answer

You didn't connect it to the function.

script.Parent.ClickDetector.MouseClick:connect(function() -- Right here.
    local DropperFree = game.Workspace.Dropper1.Dropper
    local newParts = Instance.new("Part")
    newParts.Name = "Drops"
    newParts.Parent = game.Workspace
    newParts.Position = DropperFree.Position







end)

1 comment

0

My fault ive been doing that lately thanks a lot my simple mistake reputation for you

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