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


Frame = script.Parent Textbutton = Frame.TextButton Ak47 = game:GetService("StorageService).Ak47 function HasClicked() Ak47.Parent = game.StartPack end TextButton.MouseButton1Click:connect(function(HasClicked) Print(" What does this part do " ) end)

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.

<pre class= "brush: lua"></pre>
Frame = script.Parent
TextButton = Frame.TextButton
local Ak47 = game:GetService("StorageService").Ak47
function HasClicked
    Ak47.Parent = game.StarterPack
end
TextButton.MouseButton1Click:Connect(HasClicked)
<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:

TextButton.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