alright so i have a script that clones a bomb into workspace but also a string value(Owner) and i am trying to figure out a way to make the game add leaderstat values to a player when they kill someone (for now it is set up in a way that a player can farm coins off themselfs but i will fix that later) but right now everything works fine but it doesnt add any values and yes this is a server script and yes the bomb is cloned serverside
also i new to messing around with explosions this is the first game ive ever messed with them
script:
local beep = script.Parent.beep
beep:Play()
beep.TimePosition = 0
wait(1.5)
beep:Play()
beep.TimePosition = 0
wait(1.5)
beep:Play()
wait(1.5)
local Explosion = Instance.new("Explosion")
Explosion.Parent = workspace
Explosion.Position = script.Parent.Position
Explosion.Hit:Connect(function(part,distance)
if part.Name == "UpperTorso" or "LowerTorso" or "Head" or "HumanoidRootPart" or "LeftFoot" or "LeftLowerLeg" or "LeftUpperLeg" or "LeftLowerArm" or "LeftHand" or "LeftUpperArm" or "RightFoot" or "RightUpperLeg" or "RightLowerLeg" or "RightHand" or "RightUpperArm" or "RightLowerArm" or "RightHand" then
local name = script.Parent.Owner.Value
local player = game.Players:FindFirstChild(name)
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 50
else
script.Parent:Destroy()
end
end)
script.Parent:Destroy()

4 comments
ok, you can do if game.Players:GetPlayerFromCharacter(part.Parent) instead of that long line of code checking the names
that also works for getting the player
Also, presuming that Coins is an int value, you need to do player.leaderstats.Coins.Value = ...
wow ok thanks man i didnt even realize i didnt put .Value and i had no idea about :GetPlayerFromCharacter() being able to grab Character Parts