Hello, Ive just generated a script for one of my games using Bing AI.
I want to see if its good enough to put in my game or if its broken.
The purpose of the script is to make a specific team only be allowed to sit on a certain seat.
local redTeam = game.Teams:FindFirstChild(“RedTeam”) – Replace with your actual team name
local function OnChildAdded(Child)
if Child.Name == “SeatWeld” and Child:IsA(“Weld”) then
local Character = Child.Part1.Parent
local player = game.Players:GetPlayerFromCharacter(Character)
if player and redTeam:IsPlayerInTeam(player) then
wait(0.1)
seat.Disabled = false -- Allow sitting
else
wait(0.1)
seat.Disabled = true -- Disallow sitting
end
end
local seat = Instance.new(“Seat”)
seat.Anchored = true
seat.Position = Vector3.new(0, 1, 0)
seat.Parent = workspace
local redTeam = game.Teams:FindFirstChild(“RedTeam”) – Replace with your actual team name
local function OnChildAdded(Child)
if Child.Name == “SeatWeld” and Child:IsA(“Weld”) then
local Character = Child.Part1.Parent
local player = game.Players:GetPlayerFromCharacter(Character)
if (player and player.TeamColor == redTeam.TeamColor) then
wait(0.1)
seat.Disabled = false -- Allow sitting
else
wait(0.1)
seat.Disabled = true -- Disallow sitting
end
end
end
seat.ChildAdded:Connect(OnChildAdded)
Okay so the issue with the script is i’m trying to put it in a already existing seat even tho it makes a new seat. Is there a way to fix this possibly?