I’m currently adding a boss fight to my game. i decided the boss should be a chair wielding knight, and when you sit on a chair, the chair will spin and go upwards. then the screen will fade to black and then fade back in, for the player to be face-to-face with the boss in the ‘chair dimension’. but nonmatter what I try I can’t get the player to teleport to the chair dimension during the black screen. in fact, I can’t get the player to teleport at all.
script:
local tweenservice = game:GetService("TweenService")
local doneyet = false
local function rotateFunc() ----creating the rotation tweens for the chair's body and the seat
local part = script.Parent.Seat
local part2 = script.Parent.ChairSpawner
local rotationSoeed = .1
local tweenInfo = TweenInfo.new(rotationSoeed, Enum.EasingStyle.Linear, Enum.EasingDirection.In)
local goal = {CFrame = part.CFrame * CFrame.Angles(0, math.rad(120), 0), Position = Vector3.new(part.Position.X,part.Position.Y + 10, part.Position.Z)}
local rotatePart = tweenservice:Create(part, tweenInfo, goal)
local rotateChair = tweenservice:Create(part2,tweenInfo,goal)
rotatePart:Play() ----the reason that i have 2 tweens is because i couldn't get the body to stick with the seat, it was welded on, i tried changing the owner of the weld, which weld was the "primary" weld, anchoring, un-anchoring whatever. but it didn't work so i made 2 tweens
rotateChair:Play()
rotatePart.Completed:Connect(rotateFunc)
end
script.Parent.Seat.Changed:Connect(function()
if doneyet == false then ----there was an issue with parts the code running several times
if script.Parent.Seat.Occupant ~= nil and script.Parent.Seat.Occupant:IsA("Humanoid") then --making sure it's a person on the seat
if script.Parent.Seat.Occupant.Parent.Name == script.Parent.building.Value then ---my game is a base-building game, so this checks if the person who crafted and placed the chair is the one on it
doneyet = true
script.Parent.ChairSpawner.ParticleEmitter.Enabled = true
rotateFunc() --tweens play
wait(3) --- so the player will get kinda high off the ground
game.ReplicatedStorage.RemoteEvents.BossGui:FireClient(game.Players:GetPlayerFromCharacter(script.Parent.Seat.Occupant.Parent)) ---this is for the fading to and from black, and does not interact with any of this
wait(2) ---- so the teleport will happen while the screen is black
local player = script.Parent.Seat.Occupant.Parent
script.Parent.Seat:Sit(nil) --- should empty the seat
player.Humanoid.Sit = false --- makes certain that the player is not in the seat
print(script.Parent.Seat.Occupant) ---this prints 'Humanoid' so I guess the player was still on the chair
script.Parent.Seat:Destroy() ---- destroys the seat to make even more certain that the player is not sitting on it
player.Humanoid.Sit = false ---again, anti-sitting measures. and the reason for all this is because roblox has a hard time teleporting sitting players
player:PivotTo(game.Workspace.BossFightArea.Telepart.CFrame) ---this does "fire" but the player does not move. and I did not misspell 'telepOrt' it's a pun, 'telepArt'
script.Parent:Destroy() ---and gets rid of the chair
end
end
end
end)
so the chair rotates pretty fine, but it does not go up.
I have spent around 3 hours trying to get this to work and I’m starting to think roblox is broken or I should rethink being a developer.
any help is appreciated. thanks! (unless you didn’t help)
also i am about to leave for something so i wont respond too soon