I'm making a tool that when the player clicks it'll clone the c4 model to workspace and place it where they click. I have a Script a Local Script and a ClickEvent in the tool Here are the scripts in the order I named them
local tool = script.Parent local clickEvent = tool.ClickEvent local player=game.Players.LocalPlayer local c4 = game.ServerStorage.C4Model local clickEventConnection local function createC4(location) c4:Clone(game.Workspace) c4.CFrame = location end local function onClick(player, clickLocation) createC4(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)
--Variables local tool=script.Parent local player=game.Players.LocalPlayer local mouse=player:GetMouse() local clickEvent = tool.ClickEvent --Scripts local function onActivate() local clickLocation=mouse.Hit clickEvent:FireServer(clickLocation) end tool.Activated:connect(onActivate) print("Got Click")
I'm not getting any errors in output
On line 10, try:
c4:Clone().Parent = game.Workspace
If that doesn't fix your problem, feel free to come back and maybe we can figure it out.