Very confused on why I'm getting this error, I'm trying to make a tool make a part from replicatedstorage clone to workspace when clicked on with it activated and then its cframe will be constantly moving forward in the spot your mouse clicks on, but for some reason I keep getting that error. Heres the script:
local Tool = script.Parent local Cooldown = false local CDTime = 65 Tool.RemoteEvent.OnServerEvent:Connect(function(Player, Mouse) if Cooldown then return end spawn(function() Cooldown = true wait(CDTime) Cooldown = false end) local Mugetsu = game.ReplicatedStorage.Abilities.Shinigami.Parts.Mugetsu:Clone() Mugetsu.Size = Vector3.new(1.427, 44.539, 1.55) Mugetsu.Parent = game.Workspace local pos = Player.Character.Head.Position + CFrame.new(Player.Character.Head.Position,Mouse.p).lookVector * 1 Mugetsu.CFrame = CFrame.new(pos.Mouse.p) Mugetsu.CanCollide = false Mugetsu.Anchored = false Mugetsu:SetNetworkOwner(Player) local BodyVelocity = Instance.new("BodyVelocity",Mugetsu) BodyVelocity.Velocity = Mouse.lookVector * 200 BodyVelocity.MaxForce = Vector3.new(1e8,1e8,1e8) game.Debris:AddItem(Mugetsu,3.5) Mugetsu.Touched:Connect(function(hit) if hit and not hit.Parent:FindFirstChild("Humanoid") and hit.CanCollide == true then Mugetsu:Destroy() end end) Mugetsu.Touched:Connect(function(hit) if hit.Parent == Player.Character then return end if hit and hit.Parent:FindFirstChild("Humanoid") then local EnemyHum = hit.Parent:FindFirstChild("Humanoid") EnemyHum:TakeDamage(100) Mugetsu:Destroy() end end) end)
Please help
Mouse doesnt have a Vector3. Mouse Probably uses CFrame. For a reminder, Vector3 is the code snippet that can edit positions of this in 3d space, not 2d. Plus, You should use a localscript because only the client can access its own mouse. Sorry if it sounded rude ;-;