player = game.Players.LocalPlayer
mouse = player:GetMouse()
model = game.Workspace.Model
tool = script.Parent
function onActivation()
print("Tool activated")
model = nil
end
function active()
mouse.Move:connect(hover)
end
function hover()
local function onKeyPress(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.R then
model:SetPrimaryPartCFrame(CFrame.new(mouse.hit.p.X,1.5,mouse.hit.p.Z) * CFrame.Angles(0,90,0))
end
end
game:GetService("UserInputService").InputBegan:connect(onKeyPress)
if model ~= nil and mouse.Target.Name == "Base" then
print(mouse.hit.p)
model:SetPrimaryPartCFrame(
CFrame.new(mouse.hit.p.X,1.5,mouse.hit.p.Z)) -- THIS IS WHERE MOVEMENT HAPPENS
else
print "No object"
end
end
tool.Equipped:connect(active)
tool.Activated:connect(onActivation)
COMMUNITY QUESTION
How would i go about moving an object with mouse only 4 studs at a time?
0 answers
No public answers were preserved for this question.
This discussion is preserved as it was. New answers, comments, and votes are closed.
