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

Mouse is not a valid member of Vector3?

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

2 comments

0

On line 19 you set "pos" to a Vector3 Value. And on line 20 you do "pos.Mouse". Mouse is not a property or something of a Vector3 Value. I honestly don't see what's so confusing

0

Okay

1 answer

✓ Accepted answer

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 ;-;

1 comment

0

I got it fixed, and its alright

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