hum.Died don't returns a player instance, the error is because player is nil. As character is script.Parent, you can use game.Players:GetPlayerFromCharacter(script.Parent) to get player:
local waw = game.ServerStorage:WaitForChild("Give")
local player = game.Players:GetPlayerFromCharacter(script.Parent)
local hum = script.Parent:WaitForChild("Humanoid")
hum.Died:Connect(function()
local Leaderstats = player:FindFirstChild("leaderstats")
local kepintaran = Leaderstats.Kepintaran.Value
waw:Fire(20*(kepintaran+1))
end)
Edit: As you're doing it in a dummy, you need to get player via its name:
local waw = game.ServerStorage:WaitForChild("Give")
local player = game.Players:FindFirstChild(script.Parent.Name)
local hum = script.Parent:WaitForChild("Humanoid")
hum.Died:Connect(function()
local Leaderstats = player:FindFirstChild("leaderstats")
local kepintaran = Leaderstats.Kepintaran.Value
waw:Fire(20*(kepintaran+1))
end)
2 comments
Is it a local script
i think it is not