I've had 2 of this same questions in different forums and no one can figure why it doesn't work. I have a basic roblox dummy in the workspace and it has a humanoid and everything. So When I Kill the Dummy the GiveExp Script says {xp is not a valid member of Folder}, here is the scripts.
----Leaderstats Script(Normal Script)----
game.Players.PlayerAdded:Connect(function(plr) local leaderstats = Instance.new("Folder") leaderstats.Parent = plr leaderstats.Name = "Leaderstats" local lvl = Instance.new("IntValue") lvl.Parent = leaderstats lvl.Name = "Level" local xp = Instance.new("IntValue") xp.Parent = leaderstats xp.Name = "Exp" end)
----GiveExp Script (Normal Script)----
local leaderstats = game.Players.LocalPlayer:WaitForChild("Leaderstats") game.Workspace.Dummy.Humanoid.Died:Connect(function() leaderstats.Exp.Value = leaderstats.xp.Value + 10000 end)
I've have asked this so many times and no brilliant mind can figure this out, could somebody take the time to help this old lad?
There's no such thing as LocalPlayer
in Server Scripts. You're also doing xp.Value
instead of Exp.Value