script



game.Players.PlayerAdded:connect(function(plr)
	local stats = Instance.new('IntValue', plr)
	stats.Name = 'leaderstats'
	
	local experience = Instance.new('IntValue', stats)
	experience.Name = 'EXP'
	experience.Value = 0
	
	local level = Instance.new('IntValue', stats)
	level.Name = 'level'
	level.Value = 0
	
	experience.Changed:connect(function()
	   level.Value = math.floor(experience.Value / 10) 		
	
	
	spawn(function()
		while true do
			wait(3)
			experience.Value = experience.Value +1
		end
	end)
	end)
end)

how do i make a script so that it saves my script? with that i mean so if a player plays the game and leaves his experience value wil be saved.

2 comments

1

What you need is DataStore. Go to this wiki page, read it. Try to code it, if you get stuck, return here and leave a comment. http://wiki.roblox.com/index.php/Data_store

0

thank you for youre help