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

Making a part only print when clicked while holding tool?

I would like to print something when you click a part while you are holding a tool. Here is my script. Local script in tool

local player = game.Players.LocalPlayer
local tool = script.Parent
Set = game.ReplicatedFirst.Set
local Target = game.Workspace.Block


tool.Equipped:Connect(function(mouse)
	mouse.Button1Down:Connect(function()
		if mouse.Target and mouse.Target.Parent then
		end
	end)
end)

tool.Activated:Connect(function()
    Set:FireServer(Target, tool)
end) 

player.MouseButton1Click:Connect(function()
    Set:FireServer(Target, tool)
end) 

From this one, I am getting an error. 13:07:58.182 - MouseButton1Click is not a valid member of Player

Script in tool

local player = game.Players.LocalPlayer
local tool = script.Parent
Set = game.ReplicatedFirst.Set
local Target = game.Workspace.Block

Set.OnServerEvent:Connect(function(player, Target, tool)
      if Target == "Block" and tool.Eqquiped == true then
          print ("stuff happens")
      end
end)

Thanks in advance

1 comment

0

you are getting an error because mousebutton1click is not a member of player. i think you mean the mouse of the local player. to do that add at the top plymouse = player:getMouse

1 answer

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