Clickable burger not working

I’m working on a cafe for my group. I don’t know what my error is please help if you can.:

local CheeseBurger = script.Parent

Burger.ClickDetector.MouseClick:Connect(function(player)
Burger.ClickDetector.MaxActivationDistance = 0
game:GetService(“InsertService”):LoadAsset(4884323613):GetChildren()[1].Parent = player.Backpack
end

I have no idea what is wrong With my script here is my tool name I know i have to make it the same name.

Picture of my tool.:

image

1 Like

you called the first variable CheeseBurger, then the rest Burger.

2 Likes

Its either your Variable isnt defined or your defining the wrong one

local CheeseBurger = script.Parent
--Switch to
local Burger = script.Parent

So would I change all of them to CheeseBurger?

Change all of them to Cheese Burger or switch what i said

local CheeseBurger = script.Parent

CheeseBurger.ClickDetector.MouseClick:Connect(function(player)

CheeseBurger.ClickDetector.MaxActivationDistance = 0

game:GetService(“InsertService”):LoadAsset(4884323613):GetChildren()[1].Parent = player.Backpack

end

Will that work?

yes, change all of them to either cheeseburger or burger, like what wizard said

Okay, I’m going to join and test and see if I can click on it I put the script under Click Detector.

You parented the ClickDetector to the tool, which, if I recall correctly, will not fire the MouseClick event because it isn’t a BasePart. Try connecting the tool.Activated event if you want to fire an event when the player uses the tool, and if you want to fire an event when the player clicks the handle, parent the ClickDetector to the Handle instead.

How would I do that?

30 characters
30 characters

tool.Activated:Connect(function()
    --code
end)

Okay, I did it here is what I put in. The last “end” Gave me a error.

make sure you put an “end)” to finish it off

Alright, Thanks.

30 characters
30 characters

1 Like

This is what came up.

You still kept the MouseClick event. Get rid of that, and it should be good.

What line do i remove?

30 characters

Line 4, the line with the MouseClick event.

Do I remove all of it or no?
:thinking:

Alright I removed it but now I have the first Line with a error.