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?
---------------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.CFrame = CFrame.new(Part.Position,Mouse.Hit.p) Mouse.Icon = ""--Changes the crusor icon back to normal Handle.BrickColor = BrickColor.new ("Bright red") ------------------------------------------------------------ end) end)
Part.Position
is initially Vector3.new(0,0,0)
, and that is where you are telling it to go on line 16.