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

Output not printing when left mouse button is clicked?

So this local script was initially in a model inside a folder in ReplicatedStorage, but I moved it to literally every service ever and still didn't work. This is the script:

local mouse = game.Players.LocalPlayer:GetMouse()
mouse.Button1Down:Connect(function()
	print("Yes")
end)

3 comments

1

Local Scripts inside ReplicatedStorage won't run.

0

It is cloned into CurrentCamera.

0

The initial parent needs to be the Camera, not ReplicatedStorage. If a LocalScript is put in ReplicatedStorage, it will automatically fail to function because it has no client to run with. However, you CAN put it in ReplicatedFirst and expect it to run, since ReplicatedFirst activates upon game initialization.

1 answer

This needs to be in a LocalScript.

Either have the LocalScript in one of these directories:

  1. A Player’s Backpack, such as a child of a Tool

  2. A Player’s character model

  3. A Player’s PlayerGui

  4. A Player’s PlayerScripts.

  5. The ReplicatedFirst service

2 comments

0

I’m not sure if you read his post before answering this..?

0

The problem is the gun (not a tool) is inside a model including a viewmodel, and it's cloned to CurrentCamera. If I don't make it like so it doesn't work .-.

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