- What do you want to achieve? Keep it simple and clear!
I want to go into Camera Mode and tween the text when I press a key. Then press the same key again and then it will go back to Character Mode.
- What is the issue? Include screenshots / videos if possible!
[Current Status Character Mode] there is no errors in the output the text tweened but when I press the key again and go into Camera mode the tween stoppped tweening.
local player = game.Players.LocalPlayer
local UserInputService = game:GetService("UserInputService")
local tween = game:GetService("TweenService")
local Cam = game.workspace:WaitForChild("Cam")
local CurrentCam = game.Workspace:WaitForChild("Camera")
local ShowCam = game.ReplicatedStorage:WaitForChild("ShowCamera")
local CamPosition = Vector3.new(31.726, 52.456, -52)
local LookAtPosition = Vector3.new(27.203, 45.491, -52)
local TextLabel = script.Parent:WaitForChild("TextLabel")
UserInputService.InputBegan:Connect(function(Input, chat)
if Input.KeyCode == Enum.KeyCode.C and not chat then
if TextLabel.Visible == false then
TextLabel.Visible = true
TextLabel.TextScaled = true
TextLabel.Text = "Press or Click anywhere to go back into Character Mode!"
local TextGoal = TweenInfo.new(2.5, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0.1)
local TextProperty = {TextTransparency = 1}
local TextX = tween:Create(TextLabel, TextGoal, TextProperty)
TextX:Play()
local TextXGoal = TweenInfo.new(2.5, Enum.EasingStyle.Sine, Enum.EasingDirection.In, 0, false, 0.1)
local TextXProperty = {TextTransparency = 0}
local TextZ = tween:Create(TextLabel, TextXGoal, TextXProperty)
TextZ:Play()
print("tween is playing!")
end
CurrentCam.CameraType = Enum.CameraType.Scriptable
CurrentCam.CFrame = CFrame.lookAt(CamPosition, LookAtPosition)
else
CurrentCam.CameraType = Enum.CameraType.Custom
CurrentCam.CameraSubject = player.Character.Humanoid
TextLabel.Visible = false
end
end)