Attempt to connect failed: Passed value is not a function Error

Hey! I’m getting an error in my Output of Roblox Studio that isn’t indexing a script but saying the error is from studio itself. However, I’m pretty sure it’s coming from a specific script that stopped working when this error showed up. The script and a screenshot of the error is provided below; any help with this would be appreciated! Thank you. :heart:

local PlayButton = script.Parent
local Player = game.Players.LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")
local StarterGui = game:GetService("StarterGui")
local TweenService = game:GetService("TweenService")
local IntroScreen = PlayerGui:WaitForChild("IntroScreen")
local Frame1 = IntroScreen:WaitForChild("Frame1")
local Frame2 = Frame1:WaitForChild("Frame2")
local Frame3 = Frame2:WaitForChild("Frame3")
local Logo = Frame3:WaitForChild("ImageLabel")
local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Linear)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Tween1 = TweenService:Create(Logo, tweenInfo, {Rotation = (-7)})
local Tween2 = TweenService:Create(Logo, tweenInfo, {Rotation = (7)})
local StarterPlayerScripts = game:GetService("StarterPlayer"):WaitForChild("StarterPlayerScripts")
local PlayerScripts = Player:WaitForChild("PlayerScripts")
local LoadingTextLabel = IntroScreen:WaitForChild("TextLabel")
local Active = true

PlayButton.MouseButton1Click:Connect(function()
StarterPlayerScripts:WaitForChild("Lol").Disabled = true
PlayerScripts:WaitForChild("Lol"):Destroy()
ReplicatedStorage.hahalol:FireServer()
PlayButton:TweenPosition(UDim2.new(0.5, 0,1, 200), "Out", "Bounce")
Frame1.Visible = true
Frame1:TweenSize(UDim2.new(4, 0,4, 0),"Out","Bounce",2,true)
wait(0.5)
Frame2.Visible = true
wait(0.5)
Frame2:TweenSize(UDim2.new(4, 0,4, 0),"Out","Bounce",3,true)
wait(0.5)
Frame3.Visible = true
Frame3:TweenSize(UDim2.new(4, 0,4, 0),"Out","Bounce",3,true)
wait(1)
LoadingTextLabel.Visible = true
Logo:TweenPosition(UDim2.new(0.405, 0,0.201, 0), "In", "Bounce")
LoadingTextLabel.Text = ("Loading Assets... (1/3)")
wait(1)
LoadingTextLabel.Text = ("Loading Assets... (2/3)")
wait(2)
LoadingTextLabel.Text = ("Loading Assets... (3/3)")
wait(3)
Frame1:TweenSize(UDim2.new(0.01, 0,0.01, 0),"Out","Bounce",2,true)
wait(0.5)
LoadingTextLabel.Visible = false
Logo:TweenPosition(UDim2.new(0.405, 0,-0.6, 0), "Out", "Bounce")
wait(0.5)
script.Parent.Parent.Parent.Buttons.Enabled = true
script.Parent.Parent.Parent.Point.Enabled = true
wait(1)
script.Parent.Visible = false
game.StarterGui.IntroGUI:Destroy()
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, true)
Player.PlayerGui.IntroScreen:Destroy()
local Gui = Player.PlayerGui:WaitForChild("HomeGui")
local FirstFrame = Gui:WaitForChild("FirstFrame")
wait(2)
FirstFrame:TweenPosition(UDim2.new(0.5, -271,0.5, -184), "Out", "Bounce")
end)
PlayButton.MouseEnter:Connect(function()
PlayButton:TweenSize(UDim2.new(0, 167,0, 47),"Out","Quad",0.1,true)
end)
PlayButton.MouseLeave:Connect(function()
PlayButton:TweenSize(UDim2.new(0.15, 0,0.079, 0),"Out","Quad",0.1,true)
end)

-- while task.wait() and Active do
-- Tween1:Play()
-- Tween1.Completed:Wait()
-- Tween2:Play()
-- Tween2.Completed:Wait()
-- end

Hi, I still need some help with this. Thanks.

Which line is the error referring to?

It doesn’t refer to a line, weirdly. Forgot to attach a screenshot, sorry.

Does the error only happen when you click the button?

Nope, upon joining. (30 ch.rssss)

Are you 100% sure that it’s from this script?

Not really, but this is a script that isn’t working because of it and I think most other scripts are working as normal. As soon as I added this script into the game the error started, so signs say it’s this one.

The script looks fine on its own, the issue could just be from a different script it looks like

Usually the error means that you’re calling a function somewhere in the script incorrectly (I think), if you can do try & find the source of where it could be :thinking:

3 Likes

Ah, okay! Thank you. Would fixing the error (if caused by another script) make the script above work or would it be a seperate issue? In the end, I just want the script I provided to work as it isn’t currently.

Usually, clicking on an error will bring you to the area of code that errors. And I believe that specific error is caused when incorrectly formatting a connection; I’ve had it before but can’t remember exactly what went wrong.

Right, I believe it didn’t take me to a script when I clicked on it surprisingly, I’ll try again today but I’m pretty sure it didn’t so I’m not sure what to do from here.

Solved this myself, a simple error of me trying to reference something that didn’t exist using :WaitForChild which is why it didn’t print errors. The error I screenshotted stopped occuring randomly after a certain amount of time.