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

How do you make this incinerator script that destroy boxes right ?

I'm making a incinerator where if you hold a a specific tool (BOX) it will destroy it but for some reason this script doesn't mark anything , the output doesn't say anything please help ?

local box = game.Workspace.BOX
local thing = script.Parent
local player = game.Players.LocalPlayer
thing.Touched:Connect(function()
    if player.Backpack:FindFirstChild("BOX") then
       box:Destroy()
        print("Removed the players Item")
    else if player.Backpack.Box ==false then
          player.Backpack.BOX = false
      end
    end
end)

PS this is a local script BTW

2 comments

0

What is the variable at the top?

0

The tool

1 answer

✓ Accepted answer

Use a serverscript instead of a localscript. The issue here is you trying to define player using something that would only work inside a player. Put this script inside of a part.

local thing = script.Parent
thing.Touched:Connect(function(Touch)
     local Player = Touch.Parent
print(Player)
if Player:FindFirstChild("Box") ~= nil then
	Player:FindFirstChild("Box"):Destroy()
        print("Removed the players Item")
      end
end)

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