Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

This code worked once and then stopped. No error message given and I don't understand why?

Asked by
Audiimo 105
6 years ago

I have this Intro GUI that fades out to a Custom Camera Angle then it fades in and finally fades out. But during the end of the Fade in process I have this code that moves the camera from the custom camera to the Players view.

TextSquare.TextBox.BackgroundTransparency = .0    
wait(Interval2)

local Camera = game.Workspace.CurrentCamera
local Player = game.Players.LocalPlayer
repeat wait() until Player.Character ~= nil
local Char = Player.Character                             --Camera Change

Camera.CameraType = Enum.CameraType.Scriptable
Camera.CameraSubject = Char.Head
print("tWorks")   

TextSquare.TextBox.BackgroundTransparency = .05  
wait(Waittime)

It had worked once but then it just stopped on the second test. I have put a print() in there to see if it runs through, it does, but the camera doesn't change. This is very frustrating and would really like some help on this. Thanks! FilteringEnabled is off if that has anything to do with this.

0
Why did you use BackgroundTransparency = .0? That is just like doing "0 - 10 + 10". Its more unnecessary work. hiimgoodpack 2009 — 6y
0
I have no idea what you're talking about ^^ .0 is shorthand for 0.0, which is a decimal. The difference in storage is a few bytes. No math is needed, though, it is simply 0. TheDeadlyPanther 2460 — 6y
0
Also, I believe you'd want to set CameraSubject to a Humanoid, not a head, in terms of characters. TheDeadlyPanther 2460 — 6y
0
You can set the CameraSubject to any part of the player, the Humanoid is just recommended User#9949 0 — 6y
0
Note that in Lua, 0 == .0 In Lua 5.1, the two values are truly the same, though in later versions they will be stored and printed differently. chess123mate 5873 — 6y

Answer this question