Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Need help ASAP Script won't work keep saying error and crashing why? (Read desc)

Asked by 5 years ago

My other question got removed by a mod for some reason.But, thank you to the guy/girl who helped me with this script sorry for reposting this. I hope you don't get mad at me. But, anyways I was trying to do is when the player press the button the tree explodes into pieces. Here's the script.

function onClicked(playerWhoClicked)
    workspace["Tree"]:explode()
end
script.Parent.ClickDetector.MouseClick:Connect(onClicked)

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago
function onClicked(playerWhoClicked)
    local t = workspace:FindFirstChild("Tree")
    t:Destroy() 
end
script.Parent.ClickDetector.MouseClick:Connect(onClicked)
-- if your trying to remove it.



function onClicked(playerWhoClicked)
    local t = workspace:FindFirstChild("Tree")
    local ex = Instance.new("Explosion")
   ex.Parent = t
end
script.Parent.ClickDetector.MouseClick:Connect(onClicked)
-- to explode
0
Thanks Ineedhelpscript 0 — 5y
0
It didn't work. Ineedhelpscript 0 — 5y
Ad

Answer this question