My local script isn't doing anything

What do you want to achieve?

I am making a button that will generate something when clicked. I created a part, a surface gui in the part, a text button in the surface gui, and a local script in the button.

What is the issue?

While I was working on the local script, I realized that no matter what I typed in it, nothing happened.

What solutions have you tried so far?

I tried typing variables, events, functions, and print statements, but nothing popped up in the output. I even tried typing a bunch of jibberish to create an error, but no error was marked in the output. I don’t know how to fix this and I need help. Why isn’t anything happening?

The local script that was used.

local replicatedStorage = game:GetService("ReplicatedStorage")

print("testing testing 1 2 3")

script.Parent.MouseButton1Click:Connect(function()
	replicatedStorage.StarterSetupRegen:FireServer()
end)

Screenshot of the explorer.
Screenshot 2022-07-10 172630

When you play the game if you look in the explorer, is the script still there?

1 Like

SurfaceGui’s and Billboard Gui’s are required to be attached to the player, aka needs to be inside of PlayerGui/StarterGui.

From there you can set the Adornee of the SurfaceGui to the part.

This should solve your issue!

2 Likes

LocalScripts can only work on the client, they start once they are loaded onto the client, so if they are in the workspace they will never start.

2 Likes

Yes, it’s still there and it’s in the same position too.

It’s like @realmile said, either change the LocalScript to a Script or it won’t work in the workspace

Thanks for all your help, the problem is solved.

1 Like