Hey,
So I was making a loading menu for my game and I was trying to make a loading screen that when you clicked "Play" the camera unblurred and you could load into the game. However, I am getting the error:
OnInvoke is a callback member of BindableFunction; you can only set the callback value, get is not available
My camera script goes like this:
local StarterGui = game:GetService("StarterGui") StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, false) local cam = workspace.CurrentCamera local blur = Instance.new("BlurEffect",cam) blur.Enabled = true blur.Size = 2500 cam.CameraSubject = workspace:WaitForChild("CameraPart") cam.CameraType = Enum.CameraType.Follow script.Parent:WaitForChild("Load").OnInvoke:Connect(function() if game:GetService("RunService"):IsStudio() then print("Received!") end repeat wait(.1) blur.Size = blur.Size - 10 until blur.Size <= 0 script.Parent:Destroy() end)
The button-handling script goes like this:
local play = script.Parent:WaitForChild("play") local switch = script.Parent:WaitForChild("switch") local event = script.Parent.Parent:WaitForChild("Load") play.MouseButton1Click:Connect(function() script.Parent.Visible = false script.Parent.Parent.Load:Invoke() if game:GetService("RunService"):IsStudio() then print("Sent!") end end)
I'm not really sure what I should do.
INFO: The switch code is because my game has multiple different versions.
Thanks in advance,
RoboZB
You did the OnInvoke wrong you need to set the callback like this:
local StarterGui = game:GetService("StarterGui") StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, false) local cam = workspace.CurrentCamera local blur = Instance.new("BlurEffect",cam) blur.Enabled = true blur.Size = 2500 cam.CameraSubject = workspace:WaitForChild("CameraPart") cam.CameraType = Enum.CameraType.Follow script.Parent:WaitForChild("Load").OnInvoke = function() --Fixed line. if game:GetService("RunService"):IsStudio() then print("Received!") end repeat wait(.1) blur.Size = blur.Size - 10 until blur.Size <= 0 script.Parent:Destroy() end --Remember to remove this ")"