Hi all, just wanted to ask why my script isn’t working. The area it has an error at is the TeamColor as it appears that my getplrfromchar
variable isn’t working.
It uses a clickdetector to get the info, not sure what the reason it isn’t working is, any help is appreciated.
local Players = game:GetService("Players")
local door1 = script.Parent.Parent.Door.Union
local TweenService = game:GetService("TweenService")
local tweeninfo = TweenInfo.new(
3,
Enum.EasingStyle.Quart,
Enum.EasingDirection.Out,
0,
false,
0
)
local ClosedPos1 = door1.CFrame
local OpenPos1 = {CFrame = ClosedPos1 * CFrame.new(0,2.6,0)}
local ClosePos1 = {CFrame = OpenPos1.CFrame * CFrame.new(0,-2.6,0)}
local Open1 = TweenService:Create(door1, tweeninfo, OpenPos1)
local Close1 = TweenService:Create(door1, tweeninfo, ClosePos1)
local toggle = script.Parent.Parent.Toggle
local open = script.Parent.Parent.AirReleas
local shut = script.Parent.Parent.AirReleas
local debounce = false
script.Parent.ClickDetector.MouseClick:Connect(function(chara)
local getplrfromchar = Players:GetPlayerFromCharacter(chara)
if toggle.Value == false and debounce == false then
if getplrfromchar.TeamColor == BrickColor.new("Really red") or getplrfromchar.TeamColor == BrickColor.new("Cork") then
debounce = true
open:Play()
Open1:Play()
Open1.Completed:Wait()
debounce = false
toggle.Value = true
end
end
end)