Is this a good way to give player cash if they kill a player?

if model:FindFirstChild("Humanoid") then
					if model:FindFirstChild("Humanoid").Health > 0 then
						hitSound:Play()
						model.Humanoid.Health -= 30
						wait(0.1)
						if model.Humanoid.Health == 0 then
							player.leaderstats.Candy.Value += 50
							enableUIS:FireClient(player)
						end
					end
				end```
1 Like

I like this idea of this, if you are using a Script or a LocalScript is could depend.

Personally I don’t see anything wrong with this?

Another idea is you could check on a LocalScript with the tool kill script, If the player is dead then FireServer then on the ServerScript relate to >

local function givePoints(player)
   local playerStats = player:WaitForChild("leaderstats")
   local playerWins = playerStats:WaitForChild("Wins")
   playerWins.Value = playerWins.Value + 1
end

game.ReplicatedStorage.Kill.OnServerEvent:Connect(function(player)
  givePoints(player)
end)

This code is tested and does work. This is just another option in way of doing it using a server event from local sided.

Your code looks totally fine though! Heres extra topic!

1 Like