-- SERVER SCRIPT INSIDE FALLBOARD
---> variables
local FallEvent = game.ReplicatedStorage.Remote.FallEvent
local MainPart = script.Parent.Main
local PadPart = script.Parent.Pad
local debounce = false
---> main
MainPart.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if not debounce then
debounce = true
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if plr then
FallEvent:FireClient(plr)
task.wait(0.5)
hit.Parent.HumanoidRootPart.CFrame = PadPart.CFrame
task.wait(1)
debounce = false
end
end
end
end)
I have written a function to move the camera, you can customise it to your liking.
There’s probably a better way to do it, but this works so… use this!
-- local script
local function LookNormally()
local camera = workspace.CurrentCamera
local localPlayer = game:GetService("Players").LocalPlayer
local character = localPlayer.Character
if not character then
return
end
local offset = Vector3.new(0, 5, 10)
local lookOffset = Vector3.new(0, 2, 0)
local characterCFrame = character.HumanoidRootPart.CFrame
local targetPosition = characterCFrame:PointToWorldSpace(offset)
local lookAtPosition = characterCFrame:PointToWorldSpace(lookOffset)
camera.CFrame = CFrame.new(targetPosition, lookAtPosition)
end
LookNormally()
Make a remote event and connect this function to it and everything will be ok!
Create a remote event in ReplicatedStorage and fire it from the server when you need to update the camera position. Connect this function to this event.
character.HumanoidRootPart.CFrame = CFrame.lookAt(character.HumanoidRootPart.Position, part.Position --[[You change this to whatever the position of where you want them to look at is. It should be a Vector3]], Vector3.new(0, 1, 0))
Oh, I see what you want! I thought you needed to rotate the camera!
I would suggest changing the character’s position like this:
-- SERVER SCRIPT INSIDE FALLBOARD
---> variables
local FallEvent = game.ReplicatedStorage.Remote.FallEvent
local MainPart = script.Parent.Main
local PadPart = script.Parent.Pad
local lookAtPart = script.Parent.LookPart
local debounce = false
---> main
MainPart.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if not debounce then
debounce = true
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if plr then
FallEvent:FireClient(plr)
task.wait(0.5)
-- changes here:
hit.Parent:PivotTo(CFrame.new(PadPart.Position + Vector3.new(0,10,0), lookAtPart.Position))
task.wait(1)
debounce = false
end
end
end
end)
By the way, the current debounce system might cause problems if two players fall or an NPC touches this part.You should use a table with players who are teleporting now.
Updated code:
-- SERVER SCRIPT INSIDE FALLBOARD
---> variables
local FallEvent = game.ReplicatedStorage.Remote.FallEvent
local MainPart = script.Parent.Main
local PadPart = script.Parent.Pad
local lookAtPart = script.Parent.LookPart
local playersTeleported = {} -- stores the names of players who are teleporting now
---> main
MainPart.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if plr then
if not table.find(playersTeleported, plr.Name) then -- if player not teleporting now continue
table.insert(playersTeleported, plr.Name) -- adds player name to list
FallEvent:FireClient(plr)
task.wait(0.5)
hit.Parent:PivotTo(CFrame.new(PadPart.Position + Vector3.new(0,10,0), lookAtPart.Position))
task.wait(1)
table.remove(playersTeleported, table.find(playersTeleported, plr.Name)) -- removes player name from list
end
end
end
end)
I don’t know why nothing is working. The two scripts you made both make the player go to the right spot and face the right spot but there camera dose not.