So, first I am working for my group and somewhat I have a confusing problem for me. I want it to check if the rank was guest or customer. If it's not customer it will make the money to be a number. If it's guest or Customer then their money will be N/A

So here's my script [no need to think about the data store it already works but the if is a problem.]

local DataStore = game:GetService("DataStoreService"):GetDataStore("MyDataStore") --DataStore Service.
game.Players.PlayerAdded:connect(function(player)
local guestOrCustomer = false

local leaderstats = Instance.new("IntValue")
leaderstats.Name = "leaderstats"
leaderstats.Value = 0

local rank = Instance.new("StringValue")
rank.Name = "Rank"
rank.Value = player:GetRoleInGroup() -- my group id

leaderstats.Parent = player
rank.Parent = leaderstats

-- changes for money system
local money = Instance.new("IntValue")
money.Parent = leaderstats
money.Name = "Money"

local key = "player_"..player.userId
	
	local savedValues = DataStore:GetAsync(key)
	
	if  rank.Value == "Guest" or "Customer" then --checks if staff or customer and guest
		print(rank.Value)
		guestOrCustomer = true
		print("guestOrCustomer = true")
	else
		print(rank.Value)
		guestOrCustomer = false
		print("guestOrCustomer = false")
	end
	if guestOrCustomer == false then
	if savedValues then  --used to load players data and this line checks if player has a data
		--Save format: {money}
		money.Value = savedValues[1]
	else
		local valuesToSave = {money.Value}
		DataStore:SetAsync(key, valuesToSave)
		end
	end
	
	--for N/A stuff
	if guestOrCustomer == true then
		money:Destroy()
		local newMoney = Instance.new("StringValue")
		newMoney.Parent = leaderstats
		newMoney.Value = "N/A"
		newMoney.Name = "Money"
	end
end)

I hope you can solve it for me.

3 comments

0

-.- i can tell you copied this script, or whatever. how is it supposed to see what group when there's no id? -.-

0

it's secret -_-

0

I figured it out already.