How do i find player's team inside a module script?

Im trying to make a game with team’s that have specific ranks (EXP), i tried having a basic script displaying player’s EXP and needed EXP to rank up. I used an module script to put all my teams and ranks inside.

Currently im only trying to print Needed exp but it’s not working!

Script inside StarterGui:

local player = script.Parent.Parent.Parent.Parent
local Roles = require(game.ServerStorage.Modules.Roles)
warn(Roles[player.Team.Name][player:WaitForChild("TeamData"):WaitForChild("Role").Value])

Module inside ServerStorage > Modules:

local module = {}
local Roles = {
	["Security Department"] = {
		["Recruit"] = 100,
	}
}
return module

If you need more info ask me!

Error:
Screenshot 2022-12-21 155254

Did you search for this error?

What do you mean?
Its the only error that i have in my output if that’s what is your question

1 Like

I mean, did you research the script?

I don’t know what you mean exactly but i wrote it my self without any help, this was my first time trying to use module scripts for this so i don’t know how this can be done, i just tried to do it this way since it seems better and is easier to customize but i can’t seem to make it work.

I know you don’t understand because I don’t know English, I’m an Arab

Well i understand you mostly, but it’s just that i can’t figure out what you meant with “researching” the script.

On YouTube looking for your problem

There is no tutorial about this if you meant that

1 Like

Are you converting to create a team?

local Team = game:GetService("Teams")["TeamNameHere"]

function GetTeam(player)
	if not player then
		return false
	end
	print(player.Team)
end
return GetTeam
1 Like

atleast fix this to

local Roles = {
	["Security Department"] = {
		["Recruit"] = 100,
	}
}
return Roles
1 Like

Then what is needed for this thing? Why put print(player.Team)

Not really what im looking for.

Im not sure if that will fix my error but alright?

Never mind it actually worked! Thank you

I assume he is trying to find the player’s team, which can be done by using Player.Team

1 Like

This doesn’t need he can put it in leaderstats

But in fact, you are right. Even what you said is true. Both are correct. They are all correct

1 Like

Leaderstats and print are all correct

1 Like