auto roll traits (Read Description)
Key Required

auto roll traits (Read Description)

[2X🍀] Tower Defense RNGShadowMonarchShadowMonarch 11.1K views 83 executesUpdated Nov 12, 2024
5.0/ 5(3 votes)
30100% Positive
Lua Script•126 lines (3949 chars)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local RollService = ReplicatedStorage:WaitForChild("_NetworkServiceContainer"):WaitForChild("RollService")

local activeUUID = nil
local rolling = true

local function createDraggableButton(buttonText, initialPosition, buttonColor)
    local CustomScreenGui = Instance.new("ScreenGui")
    local CustomButton = Instance.new("TextButton")
    local UICorner = Instance.new("UICorner")
    local UIStroke = Instance.new("UIStroke")
    local CoreGui = game:GetService("CoreGui")

    CustomScreenGui.Name = "RollingControlGUI"
    CustomScreenGui.Parent = CoreGui
    CustomScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
    CustomScreenGui.ResetOnSpawn = false

    CustomButton.Parent = CustomScreenGui
    CustomButton.BackgroundColor3 = buttonColor or Color3.fromRGB(255, 255, 255)
    CustomButton.BackgroundTransparency = 0.5
    CustomButton.Position = initialPosition
    CustomButton.Size = UDim2.new(0.1, 0, 0.05, 0)
    CustomButton.Text = buttonText
    CustomButton.TextColor3 = Color3.fromRGB(255, 255, 255)
    CustomButton.TextScaled = true

    UICorner.CornerRadius = UDim.new(1, 0)
    UICorner.Parent = CustomButton

    UIStroke.Parent = CustomButton
    UIStroke.Thickness = 2
    UIStroke.Color = Color3.fromRGB(0, 0, 0)

    local dragging
    local dragInput, dragStart, startPos

    CustomButton.InputBegan:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
            dragging = true
            dragStart = input.Position
            startPos = CustomButton.Position

            input.Changed:Connect(function()
                if input.UserInputState == Enum.UserInputState.End then
                    dragging = false
                end
            end)
        end
    end)

    CustomButton.InputChanged:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
            dragInput = input
        end
    end)

    game:GetService("UserInputService").InputChanged:Connect(function(input)
        if input == dragInput and dragging then
            local delta = input.Position - dragStart
            CustomButton.Position = UDim2.new(
                startPos.X.Scale,
                startPos.X.Offset + delta.X,
                startPos.Y.Scale,
                startPos.Y.Offset + delta.Y
            )
        end
    end)

    CustomButton.MouseButton1Click:Connect(function()
        rolling = not rolling
        if rolling then
            CustomButton.Text = "Stop Rolling"
            print("Rolling started.")
        else
            CustomButton.Text = "Start Rolling"
            activeUUID = nil
            print("Rolling stopped. UUID has been reset.")
        end
    end)

    return CustomScreenGui
end

local initialButtonPosition = UDim2.new(0.5, -50, 0.5, -25)
createDraggableButton("Stop Rolling", initialButtonPosition, Color3.fromRGB(0, 170, 255))

local function logArguments(args)
    print("RollService event received. Arguments:")
    for index, value in ipairs(args) do
        print(index, ":", value)
    end
end

local function attemptRoll(uuid)
    local args = {
        [1] = "attemptTraitRoll",
        [2] = uuid
    }
    RollService:FireServer(unpack(args))
    print("Attempting roll with UUID:", uuid)
end

RollService.OnClientEvent:Connect(function(...)
    local args = {...}

    if not activeUUID and args[2] and type(args[2]) == "string" then
        activeUUID = args[2]
        print("Captured UUID:", activeUUID)
    end

    logArguments(args)
end)

local function autoRoll()
    while true do
        if rolling and activeUUID then
            attemptRoll(activeUUID)
        end
        wait(1)
    end
end

spawn(autoRoll)

Features & Information

It works but not very optimized make sure to have auto roll off before you execute and after execution just roll once on any tower or trap you want to roll on after you get the traits just press stop rolling and if you wanna roll on a different tower roll one it once then press start rolling ( i tried my best to make it detect traits that you have rolled and then stop the script if you get all traits but that didn't work out well) if anyone wants to make it better please be my guest as I am not that great at coding

Community Comments (6)

ShadowMonarchShadowMonarchNov 12, 2024(edited)

I tried my best to make it as optimized as possible please read description before using it

NuggerNuggerNov 12, 2024(edited)

GPT

ShadowMonarchShadowMonarchNov 12, 2024(edited)

🤫

EZZZZZEZZZZZNov 13, 2024(edited)

nice script LIKE :)

tykunomatykunomaNov 17, 2024(edited)

very cool LIKE :)

ItzDevilBaconItzDevilBaconMar 8, 2025(edited)

my script is remix for his, the mechanic is almost same

More Scripts for [2X🍀] Tower Defense RNG