What do you want to achieve? I want to achieve rotation of the part in my sussy placement system
What is the issue? UserInputService.InputBegan refuses to work at all. I’ve tried to add an “print” function, making sure UserInputService works.
What solutions have you tried so far? Looked for solutions in Developer Hub: none. Looked for solutions in here as well - none as well.
Here’s my totally not terrible code so far:
uis.InputBegan:Connect(function(Input,GameProcessed)
if Input.UserInputType == Enum.KeyCode.E then
if rotation <= 180 then
rotation += 15
print(rotation)
end
elseif Input.UserInputType == Enum.KeyCode.Q then
if rotation >= -180 then
rotation -= 15
print(rotation)
end
end
end)
local uis = game:GetService("UserInputService")
uis.InputBegan:connect(function(key,GameProcessed)
if GameProcessed then return end
if key.KeyCode == Enum.KeyCode.E then
print("clicked E")
end
end)
this worked fine for me. Can you show the full script?
local value = script.Parent.Handle.Value
local rs = game:GetService("ReplicatedStorage")
local event = rs:WaitForChild("BuildEvent")
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local prewiews = rs:WaitForChild("Prewiew")
local prewiew = prewiews:FindFirstChild("PrewiewBrick") -- prewiew name
local clone = prewiew:Clone()
local uis = game:GetService("UserInputService")
local rotation = 0
mouse.Move:Connect(function()
if value.Value == true then
clone.Parent = workspace
clone.Position = Vector3.new(0,0,0) -- reset position
clone.Position = Vector3.new(mouse.Hit.X,mouse.Hit.Y,mouse.Hit.Z)
clone.CFrame = CFrame.Angles(0,math.rad(rotation),0)
end
end)
script.Parent.Equipped:Connect(function()
value.Value = true
end)
script.Parent.Unequipped:Connect(function()
value.Value = false
clone.Parent = rs
end)
uis.InputBegan:Connect(function(Input,GameProcessed)
if Input.KeyCode == Enum.KeyCode.E then
if rotation <= 180 then
rotation += 15
print(rotation)
end
elseif Input.KeyCode == Enum.KeyCode.Q then
if rotation >= -180 then
rotation -= 15
print(rotation)
end
end
end)
script.Parent.Activated:Connect(function()
event:FireServer(Vector3.new(mouse.Hit.X,mouse.Hit.Y,mouse.Hit.Z),rotation)
end)