This function works up until the line where I wrote "STOPS WORKING" can anybody show me what's wrong with this?


local ReplicatedStorage = game:GetService("ReplicatedStorage")
local createPartEvent = ReplicatedStorage.FISHKINDEVENTS:WaitForChild("YellowFish")

local function onCreatePartFired(player)
	wait(2)
	local coinz = game.ReplicatedStorage.PEOPLE[""..player.Name..""].FISHING.Coins
	local xpz = game.ReplicatedStorage.PEOPLE[""..player.Name..""].FISHING.XP

if player:findFirstChild("leaderstats") then
wait(0.1)
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + coinz.Value
player.leaderstats.XP.Value = player.leaderstats.XP.Value + xpz.Value --STOPS WORKING HERE
player.leaderstats.Fish.Value = player.leaderstats.Fish.Value + 1
end
end

createPartEvent.OnServerEvent:Connect(onCreatePartFired)

2 comments

1

change line 13 to player.leaderstats:WaitForChild("Fish").Value = player.leaderstats.Fish.Value +1 and see if that gives you an error you can see

0

What is the error it gives?