I want to make a team only available to people that played ex. 15+ minutes. How can I do that? If someone knows how, please tell me.
How can I make a team only available to people who played ex. 15+ minutes?
2 answers
Well, you gotta be more specific, how do you pretend to change the player's team?
First of all, assuming you already have a way of tracking how long has a player been playing for You just need to use "player.Team", and "If"
For example In this script, we change the player's team if their "leaderboard points" are higher than 15 And the script runs when the player touches a brick, which would be the change team brick
function A(h)
local char = h.Parent
local plr = game.Players:GetPlayerFromCharacter(char)
if plr.leaderstats.Time.Value >= 15 then
plr.Team = game.Teams.Janitor
end
end
script.Parent.Touched:Connect(A)
If you still don't understand, please be more specific so I can provide a better script
Then, put a number value inside your team called TimeAmount inside that value you will put the desired amount to join that team, in your case 900 seconds*(15m)*.
If the player matches the value inside the team then it will assign that team the player requested.
RemoteEvent's can be called from any script, if locally then it would be: game:GetService("ReplicatedStorage").RequestTeam:FireServer("yourteam");
Server Script:
local Teams = game:GetService("Teams")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Events = {};
Events.RequestTeam = ReplicatedStorage.RequestTeam;
Events.RequestTeam.OnServerEvent:Connect(function(PlayerInstance, RequestedTeam)
local PlayerTime = PlayerInstance:FindFirstChild("Time").Value;
if RequestedTeam and Teams:FindFirstChild(RequestedTeam) then
local TeamTime = Teams[RequestedTeam]:FindFirstChild("TimeAmount").Value;
if PlayerTime >= TeamTime then
PlayerInstance.Team = Teams[RequestedTeam];
end
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
That is very inefficient .