Creating a script where once the player sits, the orientation of one of the parts will change. Then, when the player gets up, the orientation of the part will change back. I cannot get the orientation part to work. Can anybody help?
Script:
local seat = script.Parent
local prompt = seat.Attachment.ProximityPrompt
local chair1 = script.Parent.Chair1
local plrs = game:GetService("Players")
local currentPlayer = nil
prompt.Triggered:Connect(function(plr)
local char = plr.Character
seat:Sit(char.Humanoid)
prompt.Enabled = false
print('prompt disabled')
chair1.Orientation += Vector3.new(90,0,0)
print('orientation changed')
end)
seat:GetPropertyChangedSignal("Occupant"):Connect(function()
local player = seat.Occupant
if player then
local player = plrs:GetPlayerFromCharacter(hum.Parent)
prompt.Enabled = false
print('prompt disabled')
currentPlayer = player
print('former player is', currentPlayer)
chair1.Orientation += Vector3.new(90,0,0)
print('orientation changed')
else
prompt.Enabled = true
print('prompt enabled')
currentPlayer = nil
print('former player is nil')
chair1.Orientation -= Vector3.new(90,0,0)
print('orientation changed')
end
end)