Shrek line joystick
Key RequiredUniversal

Shrek line joystick

Universal ScriptELscriptorELscriptor 1.3K views 728 executesUpdated Mar 16, 2026
5.0/ 5(1 votes)
10100% Positive
Lua Script•92 lines (3487 chars)
-- [[ JOYSTICK OPTIMISÉ - NO CAMERA GLITCH ]]
local Players = game:GetService("Players")
local LP = Players.LocalPlayer
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local Camera = workspace.CurrentCamera

-- Nettoyage
local oldUI = LP.PlayerGui:FindFirstChild("PremiumControlsFix")
if oldUI then oldUI:Destroy() end

local UI = Instance.new("ScreenGui", LP.PlayerGui)
UI.Name = "PremiumControlsFix"
UI.ResetOnSpawn = false
UI.DisplayOrder = 100

-- --- CONTENEUR DE CAPTURE (BLOQUE LA CAMÉRA) ---
local CaptureZone = Instance.new("TextButton", UI)
CaptureZone.Size = UDim2.new(0, 200, 0, 200)
CaptureZone.Position = UDim2.new(0.15, -100, 0.75, -100)
CaptureZone.BackgroundTransparency = 1
CaptureZone.Text = "" -- Important pour capturer le tactile

-- --- VISUEL DU JOYSTICK ---
local JoyMain = Instance.new("Frame", CaptureZone)
JoyMain.Size = UDim2.new(0, 120, 0, 120)
JoyMain.Position = UDim2.new(0.5, -60, 0.5, -60)
JoyMain.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
JoyMain.BackgroundTransparency = 0.5
local corner = Instance.new("UICorner", JoyMain)
corner.CornerRadius = UDim.new(1, 0)

local Stick = Instance.new("Frame", JoyMain)
Stick.Size = UDim2.new(0, 50, 0, 50)
Stick.Position = UDim2.new(0.5, -25, 0.5, -25)
Stick.BackgroundColor3 = Color3.new(1, 1, 1)
Instance.new("UICorner", Stick).CornerRadius = UDim.new(1, 0)

-- --- BOUTON SAUT (INDÉPENDANT) ---
local JumpBtn = Instance.new("TextButton", UI)
JumpBtn.Size = UDim2.new(0, 80, 0, 80)
JumpBtn.Position = UDim2.new(0.85, -40, 0.75, -40)
JumpBtn.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
JumpBtn.BackgroundTransparency = 0.4
JumpBtn.Text = "JUMP"
JumpBtn.TextColor3 = Color3.new(1, 1, 1)
JumpBtn.Font = Enum.Font.GothamBold
Instance.new("UICorner", JumpBtn).CornerRadius = UDim.new(1, 0)

JumpBtn.MouseButton1Click:Connect(function()
    if LP.Character and LP.Character:FindFirstChild("Humanoid") then
        LP.Character.Humanoid.Jump = true
    end
end)

-- --- LOGIQUE DE MOUVEMENT ---
local isDragging = false
local inputPos = Vector2.new(0,0)

CaptureZone.InputBegan:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.Touch or input.UserInputType == Enum.UserInputType.MouseButton1 then
        isDragging = true
    end
end)

UserInputService.InputEnded:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.Touch or input.UserInputType == Enum.UserInputType.MouseButton1 then
        isDragging = false
        Stick:TweenPosition(UDim2.new(0.5, -25, 0.5, -25), "Out", "Quad", 0.1, true)
    end
end)

RunService.RenderStepped:Connect(function()
    local char = LP.Character
    local hum = char and char:FindFirstChild("Humanoid")
    
    if isDragging and hum then
        local mousePos = UserInputService:GetMouseLocation()
        local center = JoyMain.AbsolutePosition + (JoyMain.AbsoluteSize / 2)
        local diff = Vector2.new(mousePos.X - center.X, mousePos.Y - center.Y)
        
        local dist = math.min(diff.Magnitude, 55)
        local angle = math.atan2(diff.Y, diff.X)
        
        -- Update visuel du stick
        Stick.Position = UDim2.new(0.5, (math.cos(angle) * dist) - 25, 0.5, (math.sin(angle) * dist) - 25)
        
        -- Calcul de direction RELATIF à la caméra
        local moveDir = (Camera.CFrame.RightVector * math.cos(angle)) + (Camera.CFrame.LookVector * -math.sin(angle))
        hum:Move(Vector3.new(moveDir.X, 0, moveDir.Z), false)
    end
end)

Features & Information

Joysticks

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts