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

My camera script is breaking after the second use?

Asked by 5 years ago

I have a Gui with a playbutton. Whenever the player clicks it they get teleported into the map, but for some reason if they die or reset and they use the same gui, their camera will be stuck at where they originally died. Also, nothing is shown in output.

Local Script inside of my screen gui


game.Lighting.Blur.Enabled = true script.Parent.Enabled = true local playbutton = script.Parent.Frame.PlayButton local frame = playbutton.Parent local campart = workspace.camera local Camera = workspace.CurrentCamera local player = game.Players.LocalPlayer local char = player.CharacterAdded:Wait() Camera.CameraType = Enum.CameraType.Scriptable repeat wait() Camera.CameraType = Enum.CameraType.Scriptable until Camera.CameraType == Enum.CameraType.Scriptable Camera.CFrame = campart.CFrame yeet = true playbutton.MouseButton1Click:Connect(function() if yeet ==true then yeet = false playbutton.BackgroundTransparency = 1 playbutton.TextTransparency = 1 frame.TextButton.BackgroundTransparency = 1 frame.TextButton.TextTransparency = 1 frame.TextLabel.TextTransparency = 1 for i = 1,10 do wait(.05) script.Parent.Frame.BackgroundTransparency = script.Parent.Frame.BackgroundTransparency -.1 end wait(.6) Camera.CameraType = Enum.CameraType.Custom game.Lighting.Blur.Enabled = false local trash = math.random(4) if trash == 1 then char.Torso.CFrame = workspace.spawns.Part1.CFrame end if trash ==2 then char.Torso.CFrame = workspace.spawns.Part2.CFrame end if trash == 3 then char.Torso.CFrame = workspace.spawns.Part3.CFrame end if trash == 4 then char.Torso.CFrame = workspace.spawns.Part4.CFrame end wait(.5) for i = 1,10 do wait(.05) script.Parent.Frame.BackgroundTransparency = script.Parent.Frame.BackgroundTransparency +.1 end script.Parent.Enabled = false yeet= true end end)

Answer this question