game["Run Service"].RenderStepped:connect(function() if Mouse.target then CloneFrom.Model:SetPrimaryPartCFrame(CFrame.new(math.floor(Mouse.hit.p.X),math.floor(game.Lighting[script.Parent.Parent.PlayerGui.Gui.Insert.Value].Model.Primary.Position.Y),math.floor(Mouse.hit.p.Z))) end end) Mouse.KeyDown:connect(function(key) if key == "r" then local model = CloneFrom.Model model.PrimaryPart = model.Primary model:SetPrimaryPartCFrame() end end)
Above is my current code.
I've tried different ways for the SetPrimaryPartCFrame() rotation but I can't seem to make it work
Any help?
UIS
KeyDown is deprecated, use the UserInputService instead.
Example:
local uis = game:GetService("UserInputService") uis.InputBegan(function(InputObject) if inputObject = Enum.KeyCode.R then --Code Here end end)
http://wiki.roblox.com/index.php?title=API:Class/UserInputService
I'm not sure what you can do next, try looking inside the ROBLOX tools to see how they did it.