Everytime I click it spawns above the player,I wan't to spawn the near the player,how would I do that?
---------------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 local Clicked = false ----------------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") Clicked = true if Clicked == true then local Part = Instance.new("Part",game.Workspace) Mouse.Move:connect(function() Part.CFrame = CFrame.new(Mouse.Origin.p) end) end 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.Anchored = true -- Part.CFrame = CFrame.new(Mouse.Hit.p) Mouse.Icon = ""--Changes the crusor icon back to normal Handle.BrickColor = BrickColor.new ("Bright red") ------------------------------------------------------------ end) end)
Try setting the brick's spawn location next to the wherever the player spawns. Use (0,0,0) except set the location you want.