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

How do I fix this?

Asked by
lucas4114 607 Moderation Voter
9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

(Idk a title for this srry) I just don't know why this function wont work, it's just one of those problems I have absolutely no idea how to fix. So, it fires the function when it hits terrain or a part but when it hits me or any other charater it doesn't. Example of what happens: https://gyazo.com/9384cd236932b75f0ea378f98345437e

Bullet.Touched:connect(function(Part)
    if Part and Part.Name == "Part" or Part.Name == "Terrain" or Part.Parent.Humanoid and not Part.Parent.Humanoid.Parent.Name == user.Name then
        HasExploded = false
        ExplosionPosition = Bullet.Position
        Explode()
    end
end)

1 answer

Log in to vote
0
Answered by 9 years ago
local Bullet = parent ex.(workspace.model.bullet)
function onTouch(part)
    if Part and Part.Name == "Part" or Part.Name == "Terrain" or Part.Parent.Humanoid and not Part.Parent.Humanoid.Parent.Name == user.Name then
        HasExploded = false
        ExplosionPosition = Bullet.Position
        Explode()
    end
end
Bullet.Touched:connect(onTouch)

Call parent the location of the bullet. Hope this works or is what you want.

0
I already have the Bullet as Bullet = script.Parent lucas4114 607 — 9y
Ad

Answer this question