So I’m trying to add to the kills value to the player who killed a player. It is not working, but it’s not giving an error! How can I fix this problem?
Client (LocalScript:)
script.Parent.KillsValue.OnClientEvent:Connect(function(the_player)
local leaderstats = the_player:FindFirstChild("leaderstats")
local RoundKills = the_player:FindFirstChild("RoundKills")
local Kills = leaderstats:FindFirstChild("Kills")
wait(0.5)
RoundKills.Value += 1
Kills.Value += 1
end)
Server (Script:)
function hitDetection(hit,ray, mousepos)
local the_player = game.Players:GetPlayerFromCharacter(character)
local model = hit:FindFirstAncestorOfClass("Model")
if model then
local humanoid = model:FindFirstChildWhichIsA("Humanoid")
if humanoid then
if hit.Name == "Head" then
humanoid:TakeDamage(configuration.HeadShotDamage)
if humanoid.Health == 0 then
script.Parent.KillsValue:FireClient(the_player)
end
else
humanoid:TakeDamage(configuration.Damage)
print(the_player)
if humanoid.Health == 0 then
script.Parent.KillsValue:FireClient(the_player)
end
end
else
return true
end
end
end
Help soon,