Top.Mail.Ru
Ответы

Roblox studio помогите дополнить скрипт

есть скрипт который в конце диалога с нпс по нажатию на кнопку тепает на плейс но камера остается приклееной к нпс помогите дополнить скрипт что бы после тп камера становилась нормальной(переключалась на игрока)

wait(1)
player = game.Players.LocalPlayer
button = script.Parent
local debounce = false

function teleport()
if not debounce then
debounce = true
LowerTorso = player.Character.LowerTorso
LowerTorso.CFrame = game.Workspace.PartTeleport.CFrame
end
end

button.MouseButton1Click:Connect(teleport)
while true do wait()
debounce = false
wait(1)
end
local Frame = script.Parent.Parent

script.Parent.MouseButton1Click:Connect(function()
Frame.Visible = false
end)

По дате
По Рейтингу
Аватар пользователя

To fix the camera issue after teleporting, you can use the `CameraFocus` property to set the focus on the player's character. Update your script as follows:```luawait(1) local player = game.Players.LocalPlayer local button = script.Parent local debounce = false function teleport() if not debounce then debounce = true local LowerTorso = player.Character.LowerTorso LowerTorso.CFrame = game.Workspace.PartTeleport.CFrame -- Set camera focus to the player's character game.Workspace.CurrentCamera.CameraSubject = player.Character end end button.MouseButton1Click:Connect(teleport) while true do wait() debounce = false wait(1) end local Frame = script.Parent.Parent script.Parent.MouseButton1Click:Connect(function() Frame.Visible = false end)```This modification sets the `CameraSubject` property of the `CurrentCamera` to the player's character after teleporting, ensuring that the camera focuses on the player.