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

Why the error? I see nothing wrong (im brand new to scripting)

The error:

Players.spradhan13.PlayerGui.ScreenGui.Frame.TextButton.LocalScript:1: attempt to call a RBXScriptSignal value

The local script in my text button:

script.Parent.MouseButton1Down(function()
	game.StarterGui.ScreenGui:Destroy()
end)

1 answer

The reason as to why you are getting an attempt to call a RBXScriptSignal value, is because you aren't connecting the MouseButton1Down function. Without connecting it, roblox has no way to tell.

You would want it to do it like this:

script.Parent.MouseButton1Down:Connect(function()
    game.StarterGui.ScreenGui:Destroy()
end)

Also, keep in mind that you cannot actually destroy the GUI via this script, because you are trying to destroy it via the StarterGui which isn't connected to the player. You would want to use PlayerGui Instead, as that IS connected to the player

Here is how you would do it:

local Player = game:GetService("Players").LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")

script.Parent.MouseButton1Down:Connect(function()
    PlayerGui.ScreenGui:Destroy()
end)

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