#i have an animation that plays after i use a proximity prompt, but the camera doesnt lock
1 messages · Page 1 of 1 (latest)
Provide a script......
your gonna want to but the camera cframe to the camerapart cframe
use a function to play the animation and change camera
sorry
** You are now Level 1! **
local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local prompt = workspace:WaitForChild("Elevator"):WaitForChild("Button"):WaitForChild("ProximityPrompt")
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "FadeGui"
screenGui.IgnoreGuiInset = true --
screenGui.Parent = player:WaitForChild("PlayerGui")
local blackFrame = Instance.new("Frame")
blackFrame.Size = UDim2.new(1,0,1,0)
blackFrame.BackgroundColor3 = Color3.new(0,0,0)
blackFrame.BackgroundTransparency = 1
blackFrame.Parent = screenGui
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://94250461421056"
local animTrack = humanoid:LoadAnimation(animation)
local function fade(to, time)
TweenService:Create(blackFrame, TweenInfo.new(time, Enum.EasingStyle.Linear), {
BackgroundTransparency = to
}):Play()
end
local camera = workspace.CurrentCamera
local head = character:WaitForChild("Head")
prompt.Triggered:Connect(function()
fade(0, 2)
wait(2)
fade(1, 0.5)
wait(0.5)
camera.CameraType = Enum.CameraType.Custom
camera.CameraSubject = head
animTrack:Play()
animTrack.Stopped:Wait()
fade(0, 1)
end)
wdym?
Does the animation include a part that is also animated
just the camera doesnt lock
local head = (pathway to head)
local cam = workspace.CurrentCamera
cam.CameraType = Enum.CameraType.Scriptable
cam.CFrame = head.CFrame
set camera type back to normal afterwards
this just makes the camera fixed to the head
do i replace that
camera.CameraType = Enum.CameraType.Custom
camera.CameraSubject = head
with this?
nw
local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local prompt = workspace:WaitForChild("Elevator"):WaitForChild("Button"):WaitForChild("ProximityPrompt")
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "FadeGui"
screenGui.IgnoreGuiInset = true --
screenGui.Parent = player:WaitForChild("PlayerGui")
local blackFrame = Instance.new("Frame")
blackFrame.Size = UDim2.new(1,0,1,0)
blackFrame.BackgroundColor3 = Color3.new(0,0,0)
blackFrame.BackgroundTransparency = 1
blackFrame.Parent = screenGui
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://94250461421056"
local animTrack = humanoid:LoadAnimation(animation)
local function fade(to, time)
TweenService:Create(blackFrame, TweenInfo.new(time, Enum.EasingStyle.Linear), {
BackgroundTransparency = to
}):Play()
end
local camera = workspace.CurrentCamera
local head = character:WaitForChild("Head")
prompt.Triggered:Connect(function()
fade(0, 2)
wait(2)
fade(1, 0.5)
wait(0.5)
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = head.CFrame
animTrack:Play()
animTrack.Stopped:Wait()
fade(0, 1)
end)
That should be it
thanks
** You are now Level 2! **
im not too sure.
oof
im importing this with a plugin from blender, do you think it could have anything to do with that?
shouldnt