New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Still have questions? Join our Discord server and get real time help.
0

# Why is the Mouse Button 1 Click code/script wont work?

I was making a class load out with GUI I have using this script but the Output said that:

****18:18:13.574 - Script 'Players.Kyle_TPD.PlayerGui.ScreenGui.Frame.Confirm.LocalScript', Line 1

Here is the srcipt:

2
Why are you saving a FireServer in a variable sheepposu 391 — 3mo
1
Please put your code in a lua code block so people can understand it better. suspectshot108 386 — 3mo

0
Edited 3 months ago

So here is you original code in a code block so its easier to read a few things that I can see that maybe causing an error is first if a objects name has a space in it you will want to put it in brackets with quotes instead of how you currently have it as the code does not know what you are looking for if there is a space because it thinks that's a different line of code

The second which is more of a question is you are storing an event as a variable while I don't believe there is anything wrong with it that makes no real sense to me or anyone else why its set up like that

Original Code:

script.Parent.button.MouseButton1Click:Connect(function()

end)


So to make it function you would like your code more like this:

script.Parent.button.MouseButton1Click:Connect(function()

game.ReplicatedStorage["Weapons Fire"]:FireServer(script.Parent.Parent.Loadout.Value) --change .Weapons Fire --> ["Weapons Fire"]

end)


That should allow your code to actually function and fire sorry if the top seemed a bit rude its just I as well as many others where very confused about the layout of your code.

so remember if a part name you are looking for has a space you will need to set up the path to look like this

game.ReplicatedStorage["Weapons Fire"]--to the script this looks like a path

game.ReplicatedStorage.Weapons Fire--to the script this looks like two different lines of code because of the space

0
I hope this works, god bless you! Kyle_TPD 0 — 3mo
0
I am unsure if this will make the entire script function as i don't know the explorer layout or what the rest of the code does but at least this could allow for the button to be clicked and fire the server with the information you plan to give it deth836231 81 — 3mo
0
wait know line 5 has an error, *facepalm* Kyle_TPD 0 — 3mo
0
Maybe because what was selected was not a Frame or a UI element there is also the fact that in the UDmi2.new() there is a .1 deth836231 81 — 3mo