Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make a rankup in-game? With a command and a value in the player (NO GROUP)

So i want to try to make a rankup script i already tried it but i don't know how to get information so like they need to say ;rankup player Politie that they can rankup and that the value from inside the player changes to the next rank? I tried this to just only get the information? but can anyone help me further how to REAL get the info? It's a serverscipt in serverscriptservice....

local users = {"MaxDev_BE"}
local teams = {"Politie"}
function checkName(player)
	for num,val in pairs(users) do
		if users[val] == player.Name then
			return true
		end
	end
	return false
end


game.Players.PlayerAdded:Connect(function(player)
	if checkName(player) then
		player.Chatted:Connect(function(msg)
			if msg:lower() == ';rankup'.. player.Name .. teams .. '' then
				
			end
		end)
	end
end)

1 answer

✓ Accepted answer

You could make two values inside the player, using this script:

game.Players.PlayerAdded:Connect(function(plr)
local folder = Instance.new("Folder")
folder.Name = "ExpStats"
folder.Parent = plr
local LVL = Instance.new("IntValue")
LVL.Name = "LVL"
LVL.Parent = folder
local EXP = Instance.new("IntValue")
EXP.Name = "EXP"
EXP.Parent = folder
end)

Then inside that script, make a datastore to save the values for the next time the player joins, so the entire script should look something like:

local datastore = game:GetService("DataStoreService")
local ds1 = datastore:GetDataStore("ExpSaveSystem")
local ds2 = datastore:GetDataStore("LevelSaveSystem")

game.Players.PlayerAdded:Connect(function(plr)
	local folder = Instance.new("Folder")
	folder.Parent = plr
	folder.Name = "ExpStats"
	local LVL = Instance.new("IntValue")
	LVL.Parent = folder
	LVL.Name = "LVL"
	local EXP = Instance.new("IntValue")
	EXP.Name = "EXP"
	EXP.Parent = folder

	EXP.Value = ds1:GetAsync(plr.UserId) or 0
	ds1:SetAsync(plr.UserId, EXP.Value)
	
	LVL.Value = ds2:GetAsync(plr.UserId) or 0
	ds2:SetAsync(plr.UserId, LVL.Value)
	
	EXP.Changed:Connect(function()
		ds1:SetAsync(plr.UserId, EXP.Value)
	end)
	
	LVL.Changed:connect(function()
		ds2:SetAsync(plr.UserId, LVL.Value)
	end)
end)

Then, In another script, make a script that when the player chats, it checks if they have enough exp to lvl and if they do, to increase the lvl by one.

local teams = {"Politie"}
game.Players.PlayerAdded:Connect(function(player)
local EXP = player.ExpStats.EXP
local LVL = player.ExpStats.LVL
player.Chatted:Connect(function(msg)
if msg:lower() == ';rankup'..player.Name..'teams'..'' then
if EXP.Value <= WhateverValTheyNeedToRankUp then
EXP.Value = EXP.Value - WhateverValTheyNeedToRankUp
LVL.Value = LVL.Value + 1
end
end
end
end)

4 comments

0

I rlly couldn't understand what u were saying, cause ur puncuation and grammar is ehhhh. So feel free to comment if u need anything

0

I want that they check what team it is and what player so the player get’s the rankup and not the player who is doing the command?

0

?

0

I don't think that's possible.. cause you'd have to reference a playername instead another string which wouldnt work.

This discussion is preserved as it was. New answers, comments, and votes are closed.