Hello I want to know in what seat a player is sitting, and I’m using
Button.MouseButton1Click:Connect(function()
if player.Character:FindFirstChild("Humanoid").SeatPart ~= "DriveSeat" then
local Camera1 = workspace.HousesSpawn.Plot1:WaitForChild("Camera1", 1)
cam.CameraType = Enum.CameraType.Scriptable
cam.CFrame = Camera1.CFrame
for i,v in ipairs(player.PlayerGui:GetDescendants()) do
if v:IsA("ScreenGui") and v.Name ~= "CamerasGUI" then
v.Enabled = false
end
end
Event:FireServer()
TextLabel.Text = "Camera1"
Frame.Visible = true
BarCall.Visible = false
UpperButtons.Visible = false
--DoorCall.Visible = false
--HouseCall.Visible = false
--Button.Visible = false
--controls:Disable()
end
end)
Button.MouseButton1Click:Connect(function()
if player.Character:FindFirstChild("Humanoid").SeatPart ~= "DriveSeat" then
local Camera1 = workspace.HousesSpawn.Plot1:WaitForChild("Camera1", 1)
cam.CameraType = Enum.CameraType.Scriptable
cam.CFrame = Camera1.CFrame
for i,v in ipairs(player.PlayerGui:GetDescendants()) do
if v:IsA("ScreenGui") and v.Name ~= "CamerasGUI" then
v.Enabled = false
end
end
Event:FireServer()
TextLabel.Text = "Camera1"
Frame.Visible = true
BarCall.Visible = false
UpperButtons.Visible = false
--DoorCall.Visible = false
--HouseCall.Visible = false
--Button.Visible = false
--controls:Disable()
end
end)
yeah it prints… both (hello1 and hello2) but I don’t understand why
local Button = script.Parent
local Frame = script.Parent.Parent.Parent.Frame.CamerasGUI.CamerasMenu
local CloseButton = Frame.CloseButton
local TextLabel = script.Parent.Parent.Parent.Frame.CamerasGUI.CamerasMenu.ImageLabel.CameraName
local player = game:GetService("Players").LocalPlayer
--local controls = require(game:GetService("Players").LocalPlayer.PlayerScripts.PlayerModule):GetControls()
local BarCall = script.Parent.Parent.Parent.BarCall
local UpperButtons = script.Parent.Parent
local cam = workspace.CurrentCamera
local Event = script.Parent:WaitForChild("Event", 1)
Button.MouseButton1Click:Connect(function()
print("Hello1")
if player.Character:FindFirstChild("Humanoid").SeatPart ~= "DriveSeat" then
print("hello2")
local Camera1 = workspace.HousesSpawn.Plot1:WaitForChild("Camera1", 1)
cam.CameraType = Enum.CameraType.Scriptable
cam.CFrame = Camera1.CFrame
for i,v in ipairs(player.PlayerGui:GetDescendants()) do
if v:IsA("ScreenGui") and v.Name ~= "CamerasGUI" then
v.Enabled = false
end
end
Event:FireServer()
TextLabel.Text = "Camera1"
Frame.Visible = true
BarCall.Visible = false
UpperButtons.Visible = false
--DoorCall.Visible = false
--HouseCall.Visible = false
--Button.Visible = false
--controls:Disable()
end
end)
The seatPart is an Object, not a string, if you want to check its name, use SeatPart.Name
Button.MouseButton1Click:Connect(function()
if player.Character:FindFirstChild("Humanoid").SeatPart.Name ~= "DriveSeat" then
local Camera1 = workspace.HousesSpawn.Plot1:WaitForChild("Camera1", 1)
cam.CameraType = Enum.CameraType.Scriptable
cam.CFrame = Camera1.CFrame
for i,v in ipairs(player.PlayerGui:GetDescendants()) do
if v:IsA("ScreenGui") and v.Name ~= "CamerasGUI" then
v.Enabled = false
end
end
Event:FireServer()
TextLabel.Text = "Camera1"
Frame.Visible = true
BarCall.Visible = false
UpperButtons.Visible = false
--DoorCall.Visible = false
--HouseCall.Visible = false
--Button.Visible = false
--controls:Disable()
end
end)