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

Mouse and Button1Down Not Working In Server Setting?

For some reason my simple localscript is not working. Is there anything that points out at you?

local Player = game.Players.LocalPlayer
local Character = Player.Character

repeat wait() until Character ~= nil

local Mouse = Player:GetMouse()



Mouse.Button1Down:connect(function()
	print("Clicked.")
end)

1 answer

✓ Accepted answer

Where do you have the script? LocalScripts must be in StarterTools or StarterGui to run, when I put it there it worked fine for me.

Just 1 suggestion I have though;

change:

local Character = Player.Character

repeat wait() until Character ~= nil

to just: local Character = Player.Character or Player.CharacterAdded:Wait()

It does the same thing, and in my opinion looks much cleaner

1 comment

0

Great, and yes it's in StarterGui.

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