Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do you fix the attemp to call a nil value error?

Players.julienblox123b.PlayerGui.ScreenGui.IntroFrame.PlayButton.PlayClient:8: attempt to call a nil value

can someone help me fix this?

Script:

-- Variables for the script to think that these locals are useful
local camera = workspace.CurrentCamera
local mainMenuMap = workspace:WaitForChild("MainMenuMap")
local tweenService = game:GetService("TweenService")
local btn = script.Parent

function tweenCamera(pos, tweenTime)
	tweenService:Create(camera,TweenInfo.New(tweenTime,Enum.EasingStyle.Linear),{CFrame = pos.CFrame}):Play()
end

btn.MouseButton1Click:Connect(function()
	btn.Visible = false
	btn.Parent.Title.Visible = false
	
	tweenCamera(mainMenuMap.CameraPart2,1)
	wait(1)
	print("Reached Destination")
end)

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.