This is the full error:
18:02:15.508 - Workspace.Health:3: attempt to index global 'data' (a nil value) 18:02:15.509 - Stack Begin 18:02:15.509 - Script 'Workspace.Health', Line 3 18:02:15.510 - Stack End
This is the full code:
local me = script.Parent.Parent
data = me:findFirstChild("Data")
skill = data.Skill.Value
function makeLowGrav(Humanoid)
print("High health", Humanoid)
Humanoid.MaxHealth = 500 + (skill.Value*10) --You can change this if you wish.
Humanoid.Health = 500 + (skill.Value*10) --You can change this if you wish. Make sure it is lower than MaxHealth.
end
function onPlayerRespawn(property, player)
-- need to connect to new humanoid
if property == "Character" and player.Character ~= nil then
makeLowGrav(player.Character.Humanoid)
end
end
function onPlayerEntered(newPlayer)
-- VERY UGLY HACK
-- Will this leak threads?
-- Is the problem even what I think it is (player arrived before character)?
while true do
if newPlayer.Character ~= nil then break end
wait(1)
end
-- start to listen for new humanoid
newPlayer.Changed:connect(function(property) onPlayerRespawn(property, newPlayer) end )
makeLowGrav(newPlayer.Character.Humanoid)
end
game.Players.ChildAdded:connect(onPlayerEntered)
`
What i'm trying to do with this script is to change the MaxHealth of the roblox user on entery (which works on its own) but the problems lies is the fact that i'm trying to increase the health and maxhealth of the user by a value (in Data) known as Skill. Thus this error comes up frequently. Any ideas?

5 comments
I've tried data = me:WaitForChild("Data") and a new error arises: 19:11:53.911 - Workspace.Health:3: attempt to index global 'data' (a nil value) 19:11:53.913 - Stack Begin 19:11:53.913 - Script 'Workspace.Health', Line 3 19:11:53.914 - Stack End
This seems like the old leaderstats script from roblox that has been changed?
WaitForChild wouldn't usually throw any errors if it can't find a child, so it looks like your me variable is wrong somehow. Try doing print(me) before setting the data variable and see what it outputs.
ah print(me) is showing the game name itself.
Maybe if data then