local sp = script.Parent sp.Touched:connect(function(part) local character = part.Parent local leaderstats = character.leaderstats local value = leaderstats.Level if character and leaderstats and value then value = 2 end end)
You can use the "GetPlayerFromCharacter" to retrieve the player through character, and the ".Character" to retrieve the character through the player. I will explain by fixing your script.
local sp = script.Parent sp.Touched:connect(function(part) if part.Parent:FindFirstChild("Humanoid") ~= nil then -- checks if it has humanoid local character = part.Parent --this will get the character, not player local player = game.Players:GetPlayerFromCharacter(character ) -- this finds the player local leaderstats = player.leaderstats local value = leaderstats.Level if player and leaderstats and value then -- I'm not sure if this is entirely needed value.Value = 2 -- You do not switch "Level" to 2, but "levels" Value, and please note that this will make it 2, not more, not less, Is this what you want? end end -- extra end due to checking if they have humanoid end)
I saw multiple problems and fixed it to what I see best fit. It's a little late here now so I'm sleepy, sorry if I messed something up. Anyways, I explained what I did in the script. Have a Good Day ComedyPumpkin (or for me, night xD) -I hope I answered your question! Please accept the answer if I did :) and if not, leave a comment!
plrname = part.parent playerinplayers = game.Players:FindFirstChild("plrname")