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

Bullet won't hurt a player?

Asked by 5 years ago
Edited 5 years ago

I have a gun that I have been scripting and building from scratch but I have come to a problem when trying to make it do damage. This is my gun code witch works fine.

01local player = game:GetService("Players").LocalPlayer
02local mouse = player:GetMouse()
03local tool = script.Parent
04 
05tool.Activated:Connect(function()
06    --Set Up
07    local bullet = Instance.new("Part")
08    --Size
09    bullet.Size = Vector3.new(0.27,0.25,1.49)
10    --Anchored
11    bullet.Anchored = false
12    --Can/Can Not Collide
13    bullet.CanCollide = true
14    --Color
15    bullet.BrickColor = BrickColor.new("Really red")
View all 39 lines...

Then this "hurt" script when cloned gets activated but does nothing upon collisions with players or dummies or objects. Here is the script.

1script.Parent.Touched:Connect(function(hit)
2    print(hit.Parent)
3    if hit.Parent:FindFirstChild("Humanoid") then
4        hit.Parent.Humanoid.Health.Value = hit.Parent.Humanoid.Health.Value - 15
5    end
6end)

here is an image of the location of things:

https://ibb.co/93B3Cch

0
JUST relized it does not print? aandmprogameing 52 — 5y
0
JUST relized it does not print? aandmprogameing 52 — 5y

1 answer

Log in to vote
0
Answered by
Alphexus 498 Moderation Voter
5 years ago

There is no value.

0
? aandmprogameing 52 — 5y
0
I need more info then that aandmprogameing 52 — 5y
0
No .Value in Health. Just remove .Value Alphexus 498 — 5y
0
did not work aandmprogameing 52 — 5y
0
did not work aandmprogameing 52 — 5y
Ad

Answer this question