Of course it wud have a red line, I gave you prototype code, not an entire script. For your sake, I will complete it here:
Prerequisites:
- Place a
RemoteEvent
named “PromptEvent” inReplicatedStorage
- A server script
- A local script parented to a
ProximityPrompt
Code:
In server script:
local Players = game:GetService("Players")
local MarketplaceService = game:GetService("MarketplaceService")
local Teams = game:GetService("Teams")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local BCSO_TEAM = Teams.BCSO
local OPD_TEAM = Teams.OPD
local RE = ReplicatedStorage:WaitForChild("PromptEvent")
Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function()
if MarketplaceService:UserOwnsGamePassAsync(Player.UserId, 28301022) and Player.Team == OPD_TEAM then
RE:FireClient(Player)
end
end)
end)
In localscript:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RE = ReplicatedStorage:WaitForChild("PromptEvent")
--// Events
RE.OnClientEvent:Connect(function()
script.Parent.Enabled = true
end)