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

Why can I not damage this zombie in roblox studio? Me and my friend cant figure it out.

So me and my friend have just gotten into scripting and we followed this tutorial on how to make a simple attack and how to make it do damage. Our problem is that we cant do damage for some reason. Can someone please tell us what we did wrong in our script? we checked multiple times and we really cant figure out what is wrong.

Thanks in advance!

Local script:Player = game.Players.LocalPlayer Mouse = Player:GetMouse()

Mouse.KeyDown:connect (function(key) key = key:lower() if key == "f" then local x = Instance.new("Part", workspace) x.Shape = "Ball" x.BrickColor = BrickColor.new("White") x.Transparency = 0.5 x.TopSurface = "Smooth" x.BottomSurface = "Smooth" x.CFrame = Player.Character.UpperTorso.CFrame * CFrame.new(0,-1,-6) local v = Instance.new("BodyVelocity", x) v.velocity = Player.Character.UpperTorso.CFrame.LookVector * 90 v.maxForce = Vector3.new (math.huge, math.huge, math.huge) local f = Instance.new("Fire") f.Size = 10 f.Parent = x

local S = script("script"):clone() S.Disabled = false S.Parent = x x.Parent = workspace

wait(2) x:remove()

end

end)

the script that is inside the local script:

script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid")~= nil then hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 20 script.Parent:remove() end

end)

2 comments

0

Put it in a regular script, or/and use remote functions to hurt the player when fired.

0

make sure to use the code block

1 answer

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