I have this FE edited RRP2 gun system for my game’s gun system. I want it to be able to do double the damage when it hits the target’s head. I’ve got the server side set up, but for some reason the client side doesn’t work. I’ve gotten no errors, I’ve added ends to fix the red lines, but it turns a bunch of the code blue and said it should change to local when it didn’t do that before. Help?
if hitObject and hitObject.Parent then
local hitHumanoid = hitObject.Parent:FindFirstChild("Humanoid")
local hitHead = hitObject.Parent:FindFirstChild("Head")
if hitHumanoid then
local hitPlayer = game.Players:GetPlayerFromCharacter(hitHumanoid.Parent)
if MyPlayer.Neutral or hitPlayer then
TagHumanoid(hitHumanoid, MyPlayer)
script.Parent.DamageEvent:FireServer(hitHumanoid)
if hitHead then
local hitPlayer = game.Players:GetPlayerFromCharacter(hitHead.Parent)
if MyPlayer.Neutral or hitPlayer then
TagHumanoid(hitHead, MyPlayer)
script.Parent.HitHeadEvent:FireServer(hitHead)
if bullet then
bullet.BrickColor = BrickColor.new("Maroon")
bullet.Material = "Pebble"
local randomnumber = math.random(1, 3)---randomized blood hit sound
if randomnumber == 3 then
script.Parent.Handle.HitSounds.BloodHit3:Play()
end
if randomnumber == 2 then
script.Parent.Handle.HitSounds.BloodHit2:Play()
end
if randomnumber == 1 then
script.Parent.Handle.HitSounds.BloodHit1:Play()
end
end
spawn(UpdateTargetHit)
end
end
end