Hello,
So I have a simple puzzle in my game where you’ll need to find a machete to cut down a tree trunk blocking the way, works just fine. My only problem is how the tool only gets removed from the inventory of the person who put it to use and doesn’t remove it for the others as well afterwards since the tool will no longer be needed. Pretty simple stuff you may say but since I’m not the best at scripting I struggle a bit right now with adjusting certain code. Here’s my script:
local CutTrunkBrick = script.Parent.Parent.CutTrunkBrick
local MacheteProp = game.Workspace.Givers.machete
local Cutting = script.Parent.cutting
Model = script.Parent.Parent
function ontouch(hit)
local machetekey = hit:findFirstChild("machetekey")
if machetekey then hit.Parent:Destroy()
MacheteProp:Destroy()
CutTrunkBrick:Destroy()
Cutting:Play()
script.Disabled = true
Cutting.Ended:Wait()
script.Disabled = false
Model:Destroy()
end
end
script.Parent.Touched:Connect(ontouch)
I’d appreciate your help very much!!