I create a Tool following this tutorial: Player Tools
This is structure: Screen
This is code of Server Script:
-- Server Script
local tool = script.Parent
local clickEvent = tool.ClickEvent
local clickEventConnection
local function createPart(location)
local part = Instance.new("Part")
part.CFrame = location
part.Parent = workspace
end
local function onClick(player, clickLocation)
createPart(clickLocation)
end
local function onEquip()
clickEventConnection = clickEvent.OnServerEvent:connect(onClick)
end
local function onUnequip()
clickEventConnection:disconnect()
end
tool.Equipped:connect(onEquip)
tool.Unequipped:connect(onUnequip)
This is code of Local Script:
-- Local Script
local tool = script.Parent
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local clickEvent = tool.ClickEvent
local function onActivate()
local clickLocation = mouse.Hit
clickEvent:FireServer(clickLocation)
end
tool.Activated:connect(onActivate)
But when i clicked in game i have this error: ClickEvent is not a valid member of Tool
But it should create a part at the place where you click.
Why it is not work?

2 comments
There is no "ClickEvent" for a tool. You could use the Button1Click event of the mouse, adn then just check if they have the tool equipped
You sure you have a RemoteEvent named ClickEvent in the tool?