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

My script won't work, when i use mousebutton1click?

Asked by 5 years ago
Edited 5 years ago
01<pre class="brush: lua"></pre>
02 
03 
04Frame = script.Parent
05Textbutton = Frame.TextButton
06Ak47 = game:GetService("StorageService).Ak47
07 
08function HasClicked()
09    Ak47.Parent = game.StartPack
10end
11 
12TextButton.MouseButton1Click:connect(function(HasClicked)
13Print(" What does this part do " )
14end)
15 
16 
17<pre class="brush: lua"></pre>

I don't believe there are any errors, but it just won't work

2 answers

Log in to vote
1
Answered by 5 years ago

First of all, let me fix this script. I noticed you made a few errors.

1<pre class= "brush: lua"></pre>
2Frame = script.Parent
3TextButton = Frame.TextButton
4local Ak47 = game:GetService("StorageService").Ak47
5function HasClicked
6    Ak47.Parent = game.StarterPack
7end
8TextButton.MouseButton1Click:Connect(HasClicked)
9<pre class="brush: lua"></pre>

Ah! Much better.

Problems

1) On line 6, you did "StartPack" not "Starterpack" I don't think there's such thing as "StartPack".

2) On line 8, don't use :connect(). It's deprecated and it doesn't work anymore; Try using :Connect().

3) On line 8, you made another function by making the function(HasClicked), furthermore you need to do the following:

1TextButton.MouseButton1Click:Connect(HasClicked)

The reason why there is no end) is because it's connecting to a function you made, not creating another in the same line of code.

4) Lastly, on line 13 of your code, it is print() not Print().

If I helped, let me know down on the comments. If you don't understand something, just ask me.

Ad
Log in to vote
0
Answered by 5 years ago

It is not Print() it is print()

Answer this question