Im trying to make it so if the player click and hold's a button, it can turn their character depending on if they click and hold the left button or right.
I was thinking of doing something like this :
button = script.Parent active = false char = game.Players.LocalPlayer.Character button.MouseButton1Down:Connet(function() active = true if active == true then turn = char:GetChildren() while true do turn.CFrame.fromEulerAnglesXYZ(0, 0, 0) +Vector3.new(1, 1, 1) end end end) button.MouseButton1Up:Connect(function() active = false end)
Im not use to CFraming, so what i wrote may be a bunch of nonsense, but that's an idea i thought on how it would work, but it isn't.
LocalScript in StarterCharacterScripts. Edited for systemis~
local player = game.Players.LocalPlayer local character = player.Character local humanoid = character:WaitForChild("Humanoid") local torso = character:WaitForChild("HumanoidRootPart") local mouse = player:GetMouse() -- Use UserInputService for user input, not the mouse. local UserInputService = game:GetService('UserInputService') UserInputService.InputBegan:Connect(function(input) humanoid.AutoRotate = false while UserInputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton1) do torso.CFrame = CFrame.new(torso.CFrame.p, Vector3.new(mouse.Hit.x, torso.CFrame.y, mouse.Hit.z)) wait() end humanoid.AutoRotate = true end)