Hello, I am doing a build system and I am having some problems, I need to make that when I press the button it is instance the part in the mouse position and if I press the R the part can be rotated, how do I do that?
localscript:
local UIS = game:GetService("UserInputService")
local button = script.Parent
button.MouseButton1Click:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
print("Check 1")
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local build = Instance.new("Part")
build.Parent = workspace
mouse.TargetFilter = build
local RunService = game:GetService("RunService")
local RATE_PER_SECOND = 2
RunService.RenderStepped:Connect(function(step)
local increment = RATE_PER_SECOND * step
build.Position = mouse.Hit.p
mouse.Hit.p = increment
end)
if input.UserInputType == Enum.KeyCode.R then
print("rotating")
end
end
end)