LocalScript inside StarterPlayerScripts
I am basically making a script where you go into a magnitude of a block, a gui pops up you click e and then more guis pop up. From there you can then naviage left or right (what Im trying to do)
but there seems to be an issue with it( On my second stepped)
I have it print my characters name for the first time I prompt it to, but not the second, which is very startling because of everything appearing to meet my conditions.
(long script)
error would appear to be under "-- // Manuvering through the shop \\ --" at the very bottom
-- Made By AltNature
-- What we want to do -- [ 1. When you enter the brick , bring up the gui ]
--[[ "Press E to open shop" , Player clicks "E" Then transitions into custom camera mode like Mining simulator
to choose your weapon. ]]--
-- // Variables \\ --
local f = game.Workspace.CameraParts
local debounce = false
local check = true
local player = game.Players.LocalPlayer
local pressE = game.Players.LocalPlayer.PlayerGui:WaitForChild("gunShopGUI"):WaitForChild("pressE")
local pressEadd = game.Players.LocalPlayer.PlayerGui:WaitForChild("gunShopGUI"):WaitForChild("pressEadd")
local userInput = game:GetService("UserInputService")
local humanoid = player.Character.Humanoid
local s = player.PlayerGui:WaitForChild("gunShopGUI")
local sl = s.Lefts
local sr = s.Rights
local cameras = {f.Revolver,
f.G36C,
f.GoldRevolver,
f.USP,
f.HK417,
f.FP6,
f.MG4,
f.AWM_F}
local lefts = {sl.Left,
sl.LeftBottom,
sl.LeftTop,
sl.LeftLeft,
sl.LeftRight}
local rights = {sr.Right,
sr.RightBottom,
sr.RightTop,
sr.RightLeft,
sr.RightRight}
local exit = s.Exit
local Camera = workspace.Camera
-- // Camera Functions \\ --
function cameraMode()
local target
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CameraSubject = target
wait()
local target = cameras[1]
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = target.CFrame
end
function cameraModetwo()
local target
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CameraSubject = target
wait()
local target = cameras[2]
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = target.CFrame
end
function cameraModethree()
local target
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CameraSubject = target
wait()
local target = cameras[3]
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = target.CFrame
end
function cameraModefour()
local target
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CameraSubject = target
wait()
local target = cameras[4]
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = target.CFrame
end
function cameraModefive()
local target
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CameraSubject = target
wait()
local target = cameras[5]
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = target.CFrame
end
function cameraModesix()
local target
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CameraSubject = target
wait()
local target = cameras[6]
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = target.CFrame
end
function cameraModeseven()
local target
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CameraSubject = target
wait()
local target = cameras[7]
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = target.CFrame
end
function cameraModeEight()
local target
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CameraSubject = target
wait()
local target = cameras[8]
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = target.CFrame
end
function exitCameraMode()
Camera.CameraType = Enum.CameraType.Custom
Camera.CameraSubject = player.Character.Humanoid
Camera.CFrame = player.Character.Head.CFrame
player.Character.Humanoid.WalkSpeed = 16
end
-- // =================== \\ --
function visibleRightandLeftandExit()
for i, v in pairs(lefts) do
v.Visible = true
end
for i, v in pairs(rights) do
v.Visible = true
end
exit.Visible = true
end
function invisibleRightandLeftandExit()
for i, v in pairs(lefts) do
v.Visible = false
end
for i, v in pairs(rights) do
v.Visible = false
end
exit.Visible = false
end
function input()
userInput.InputBegan:Connect(function(input, gp) -- If they click "E" , then cameraMode()
if input.KeyCode == Enum.KeyCode.E then
if not gp then
cameraMode()
visibleRightandLeftandExit()
player.Character.Humanoid.WalkSpeed = 0
pressE.Parent = game:GetService("ServerStorage")
pressEadd.Parent = game:GetService("ServerStorage")
end
end
end)
end
-- // The Activation \\ --
game:GetService("RunService").RenderStepped:Connect(function()
if (player.Character.HumanoidRootPart.Position - workspace.Part.Position).Magnitude <= 11 then
pressE.Visible = true
pressEadd.Visible = true
input()
print("Rendering")
elseif (player.Character.HumanoidRootPart.Position - workspace.Part.Position).Magnitude > 11 then
pressE.Visible = false
pressEadd.Visible = false
print("Rendering")
end
end)
humanoid.Died:Connect(function()
exitCameraMode()
if Camera.CameraType == Enum.CameraType.Custom then
wait(5)
pressE.Parent = s
pressEadd.Parent = s
player.Character.Humanoid.WalkSpeed = 16
invisibleRightandLeftandExit()
end
end)
-- // Manuvering through the GUI shop \\ --
if Camera.CameraSubject ~= player.Character.Humanoid and rights[1].Visible == true then
lefts[1].MouseButton1Click:Connect(function()
if Camera.CameraSubject ~= cameras[1] then
if Camera.CameraSubject == cameras[2] then
cameraMode()
end
if Camera.CameraSubject == cameras[3] then
cameraModetwo()
end
if Camera.CameraSubject == cameras[4] then
cameraModethree()
end
if Camera.CameraSubject == cameras[5] then
cameraModefour()
end
if Camera.CameraSubject == cameras[6] then
cameraModefive()
end
if Camera.CameraSubject == cameras[7] then
cameraModesix()
end
if Camera.CameraSubject == cameras[8] then
cameraModeseven()
end
end
end)
rights[1].MouseButton1Click:Connect(function()
if Camera.CameraSubject ~= cameras[8] then
if Camera.CameraSubject == cameras[1] then
cameraModetwo()
print("Maybe by chance? "")
end
if Camera.CameraSubject == cameras[2] then
cameraModethree()
end
if Camera.CameraSubject == cameras[3] then
cameraModefour()
end
if Camera.CameraSubject == cameras[4] then
cameraModefive()
end
if Camera.CameraSubject == cameras[5] then
cameraModesix()
end
if Camera.CameraSubject == cameras[6] then
cameraModeseven()
end
if Camera.CameraSubject == cameras[7] then
cameraModeEight()
end
end
end)
end
exit.MouseButton1Click:Connect(function()
exitCameraMode()
end)

3 comments
Too much code. Can you try and crop it down to where the problem might be occurring if possible?
^ Up vote
Next time, just post the part of the script where you are having the problems.