How would I make it so when someone kills another player they get +5 coins? I watched multiple different videos on it but it did not help me out as they’re doing a whole leaderstats script which I do not need as I already have one, I only just need the part where when someone kills another person they get +5 coins.
If someone can put me in the right direction on making one or send me a tutorial that would be awesome.
You could maybe create and fire a BindableEvent when you kill a player, and use another script to check if the BindableEvent was fired, and add to the player’s coins if so.
Here’s a tutorial showing you how to use them: Roblox Bindable Events Tutorial - YouTube, if you want, you could just add the coins to the player inside the weapons’ script and using BindableEvents wouldn’t be neccesary, but it might maybe look a little messy.
local hum = char:WaitForChild("Humanoid")
hum.Died:Connect(function()
local tag = hum:FindFirstChild("creator")
if tag then
local player = tag.Value
local coins = player.leaderstats.Coins
coins.Value = coins.Value + 5
end
end)