Idea The idea is to simple detect what the player shoots, and deal with it accordingly.
Problem The Problem is on line 21, im sure its a simple fix but im not positive. Thanks :D
Code
game.ReplicatedStorage.Remotes.Shoot.OnServerEvent:connect(function(player, hit, damage)
if hit then
if hit.Parent:FindFirstChild("Humanoid") then
if hit.Name == "Head" then
hit.Parent.Humanoid:TakeDamage(damage * 2)
else
hit.Parent.Humanoid:TakeDamage(damage)
end
elseif hit.Parent.Parent:FindFirstChild("Humanoid") and not hit.Parent:IsA("Tool") then
if hit.Name == "Handle" then
hit.Parent.Parent.Humanoid:TakeDamage(damage * 2)
else
hit.Parent.Parent.Humanoid:TakeDamage(damage)
end
end
if hit.Parent:FindFirstChild("LastHit") then
hit.Parent.LastHit.Value = player
elseif hit.Parent.Parent:FindFirstChild("LastHit") then
hit.Parent.Parent.LastHit.Value = player
end
if hit.Parent == game.Workspace.Core and player.TeamColor == "Crimson" then
hit.Parent.Health.Value = hit.Parent.Health.Value - damage
hit.Parent.LastHit.Value = player
end
end
end)
game.ReplicatedStorage.Remotes.ChangeWalkSpeed.OnServerEvent:connect(function(player, speed)
if player.Character and player.Character.Humanoid then
player.Character.Humanoid.WalkSpeed = speed
end
end)
Hai> Hai
