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

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



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

✓ Accepted answer

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.

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

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