Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Error in start GUI?

Asked by
Vid_eo 126
9 years ago

I was making a start GUI for my game, but when I tested it it said "Attempt to call a string value" Here's the script:

Player = game.Players.LocalPlayer
Background = script.Parent.Parent:WaitForChild("Background")
Play = script.Parent

function OnClicked()
    Background.Visible = false
end

Play.MouseButton1Down:connect("OnClicked")


Thanks!

2 answers

Log in to vote
0
Answered by 9 years ago

Error on line 9 should be

Play.MouseButton1Down:connect(OnClicked)-- no abbreviations needed because it's a unctions name not string
0
Thanks, idk why i put that :P Vid_eo 126 — 9y
Ad
Log in to vote
1
Answered by 9 years ago

Change this:

Play.MouseButton1Down:connect("OnClicked")

to this:

Play.MouseButton1Down:connect(OnClicked)

You put a string value, into the :connect function. It won't work, because that doesn't receive strings. It can only be just the name of a function like that. Hope it works, and I also hope I helped!

Answer this question