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

Why isn't mouse.hit working properly?[Not Fixed]

I was making a script that spawns a part (Line 14) where ever the player clicks with the tool,but for some reason it spawns in the middle of the base plate why?

Picture Of Problem

---------------Vairbles---------------
local Tool = script.Parent
local Handle = script.Parent.Handle
local Player = game.Players.LocalPlayer--Gets LocalPlayer(which is the player with tool or script)
local PlayersMouse = Player:GetMouse()--Gets the Players mouse with the GetMouse() method
----------------EquipedEvent-------------
	Tool.Equipped:connect(function(Mouse)
		---------------------Button1Down---------------------------------
		Mouse.Button1Down:connect(function()--When the player press the right button(Button1) it will do the thing below
			Mouse.Icon  = "http://www.roblox.com/asset/?id=13890082"--Changes the crusor Icon to a plus sign
			Handle.BrickColor = BrickColor.new("Bright green")
			end)
			--------------------Button1Up---------------------------------
			Mouse.Button1Up:connect(function()--When the player releases the right button(Button1) it will do the thing below
					local Part = Instance.new("Part",game.workspace)
						Part.Position = Vector3.new(Mouse.Hit)
				Mouse.Icon = ""--Changes the crusor icon back to normal
				Handle.BrickColor = BrickColor.new ("Bright red")
				------------------------------------------------------------
			end)
	end)

1 answer

Try this, I'm not sure , sorry if it doesn't work!

Part.CFrame = CFrame.new(Part.Position,mouse.Hit.p)
end)

1 comment

0

It didn't work,but thanks

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