I'm trying to make a script that stores the value "Cash" in my script for a sword fighting game. I'm getting the error above on line 15 and I have no idea how to fix it since I got assistance from a YouTube tutorial on how to make this. If anyone could help that would be great.
local maxlevel = 25
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = player:WaitForChild("leaderstats")
local level = leaderstats:WaitForChild("Level")
local xp = leaderstats:WaitForChild("XP")
while wait() do
local levelvalue = level.Value
local xpneeded = ((levelvalue * 2) - 1) * 50
if level.Value < maxlevel then
if xp.Value >= xpneeded then
level.Value = level.Value + 1
xp.Value = xp.Value - xpneeded
end
end
end
end)

3 comments
when you SetAsync, it takes a key as the first parameter and a variant as the second parameter
do i not have that?
One of your errors is having a period instead of a comma separating those 2 arguments in each SetAsync