so i have a cat game called "Eaten By Cats!" by SethPaw, and I want there to be a mechanic where if you are already a poop and you get eaten again, the cat's mouth explodes. the mechanic i am done with is the poo mechanic, where you turn into poo when digested by the cat. but I cant quite get the explosion mechanic working. what happens is... nothing. i can get eaten and become a poo, but sadly the explosion thing doesn't do anything, poo mesh or not.
function onHit(hit) if (hit.Parent.Head.Balloon:FindFirstChild("Mesh")~=nil) then local exp = Instance.new("Explosion") exp.Position = script.Parent.Position end end
script.Parent.Touched:connect(onHit)
What's the problem!!?? link to the unfinished game: https://www.roblox.com/games/735444651/Eaten-By-Cats
I did some tidying
First of all
You didn't put in exp.Parent
That is important
Or else the instance
would be nil
local debounce = false function onHit(hit) if hit.Parent.Head.Balloon:FindFirstChild("Mesh") and debounce == false then debounce = true local exp = Instance.new("Explosion") exp.Position = script.Parent.Position exp.Parent = hit.Parent.Torso -- You didn't set the parent of the Instance else print("Hit.Parent.Head.Ballon.Mesh is nil") end wait() if debounce == true then debounce = false end end script.Parent.Touched:Connect(onHit)
Please submit this answer if it worked!