Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Making a part only print when clicked while holding tool?

Asked by 4 years ago
Edited 4 years ago

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

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 Erie20 102 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

Answer

Ad

Answer this question