Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

why i got this error attempt to index nil with 'leaderstats'?

i try to make this a code which is give you a reward after killing it. But i try to define kepintaran as a child of leaderstats but it doesnt work

local waw = game.ServerStorage:WaitForChild("Give")
local hum = script.Parent:WaitForChild("Humanoid")

hum.Died:Connect(function()
	local player = game.Players.LocalPlayer
		local kepintaran = player.leaderstats.Kepintaran.Value
		waw:Fire(20*(kepintaran+1))
	end)

1 answer

Are you doing this on the server, LocalPlayer will not work on server!

2 comments

0

where should i put it

0

wheres the player you want to kill

This discussion is preserved as it was. New answers, comments, and votes are closed.