Gamepass Help with Teams

I have been trying to fix this for a while i bought a game called odesy asylum and im trying to fix this game pass script and it wont work after you bought the gamepass it wont let you get on the team.

local Teams = game:GetService(“Teams”)
local Player = game:GetService(“Players”).LocalPlayer
local Market = game:GetService(“MarketplaceService”)
local Team = Teams:WaitForChild(“Max Security Patient”)
local Remote = game:GetService(“ReplicatedStorage”):WaitForChild(“HotdogEat”)
local PassId = script.Parent.PassId.Value
local Click = script.Parent.Choose
local Text = script.Parent.Choose.TextLabel
local Text2 = script.Parent.Choose.TextLabel.Back

if PassId ~= 0 then
if Market:UserOwnsGamePassAsync(Player.UserId, PassId) then
Text.Text = “PLAY”
Text2.Text = “PLAY”
Click.ImageColor3 = Color3.fromRGB(57, 106, 52)
end
end

Click.MouseButton1Click:Connect(function()
if PassId == 9763638 then
Remote:FireServer(Team)
elseif PassId ~= 0 then
if Market:UserOwnsGamePassAsync(Player.UserId, PassId) then
Remote:FireServer(Team, PassId)
else
Market:PromptGamePassPurchase(Player, PassId)
end
end
end)

2 Likes

First of all, format your code.

Second - I believe we are missing a script. You reference a remote yet you don’t post the preceding script.

If you type ``` on each end of your code, it will show up as a script instead of regular text. And indenting with tab makes it more readable.

It appears that you are firing a remote event to change the team, where it says “Remote:FireServer(Team, PassId)”. Can you also add the code in the server script that changes the teams? Because the code that is supposed to change the team isn’t here, its in the script that runs when the remote event is fired.

trying to find it
wadwasdwasdwasdwwa

local Teams = game:GetService("Teams")
local Market = game:GetService("MarketplaceService")

Remote.OnServerEvent:Connect(function(Player, Team, PassId)
	if PassId == nil then
		if Team == Teams["Patient"] or Team == Teams["Medical Unit"] or Team == Teams["Security Unit"] then
			Player.Team = Team
			Remote:FireClient(Player)
			Player:LoadCharacter()
		else
			shared.ExploitLog(Player, "Attempted to join a gamepass team with no ID. Requested team:" .. tostring(Team))
			Player:Kick("[EXPLOIT DETECTION] You tried to join a gamepass team with no ID. Administration has been notified")
		end
	elseif PassId ~= nil then
		if Team == Teams["Max Security Patient"] and PassId == 8508203 or Team == Teams["Emergency Task Force"] and PassId == 8508209 or Team == Teams["Hospital Administrator"] and PassId == 8508213 or Team == Teams["Hostile Overwatch"] and PassId == 8508220 or Team == Teams["Hostile Forces"] and PassId == 8508221 or Team == Teams["Facility Overwatch"] and PassId == 8508223 or Team == Teams["Critical Hazard Squad"] and PassId == 8508226 or Team == Teams["Intelligence Agency"] and PassId == 8508228 then
			if Market:UserOwnsGamePassAsync(Player.UserId, PassId) then
				Player.Team = Team
				Remote:FireClient(Player)
				Player:LoadCharacter()
			end
		else
			shared.ExploitLog(Player, "Attempted to join a gamepass team with a Invalid ID. Requested team:" .. tostring(Team))
			Player:Kick("[EXPLOIT DETECTION] You tried to join a gamepass team with a Invalid ID. Administration has been notified")
		end
	end
end)```
1 Like