#help with model position when event finished

1 messages · Page 1 of 1 (latest)

trail thorn
#

okay so i have some scripts and remote events bcuz im making poop the brainrot but i got a problem the brainrot doesnt spawn and it did once and then it just didnt grow or go to my inventory i send the scripts so u can see them the scripts r too long for me to show tho

#
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")

local button = script.Parent
local gui = script.Parent.Parent
local totalClicks = 10
local clicked = 0

local spawnRemote = ReplicatedStorage:WaitForChild("SpawnBrainrot")
local growRemote = ReplicatedStorage:WaitForChild("GrowBrainrot")
local finishedEvent = ReplicatedStorage:WaitForChild("FinishedPoop")

-- Spawn poop button with tween
local function spawnButton()
    local newBtn = Instance.new("TextButton")
    newBtn.Size = UDim2.new(0, 100, 0, 50)
    newBtn.Text = "💩"
    newBtn.BackgroundColor3 = Color3.fromRGB(91, 90, 90)
    newBtn.TextScaled = true
    newBtn.Parent = gui
    local corner = Instance.new("UICorner")
    corner.CornerRadius = UDim.new(0.2, 0)
    corner.Parent = newBtn

    -- random position
    newBtn.Position = UDim2.new(math.random(), 0, math.random(), 0)
    newBtn.AnchorPoint = Vector2.new(0.5, 0.5)

    -- start invisible
    newBtn.Size = UDim2.new(0, 0, 0, 0)

    -- tween in
    local tweenInfo = TweenInfo.new(0.3, Enum.EasingStyle.Back, Enum.EasingDirection.Out)
    TweenService:Create(newBtn, tweenInfo, {Size = UDim2.new(0, 100, 0, 50)}):Play()

    newBtn.Activated:Connect(function()
        clicked += 1
        growRemote:FireServer() -- make brainrot grow
        newBtn:Destroy()

        if clicked < totalClicks then
            spawnButton()
        else
            finishedEvent:FireServer() -- done, poop finished
        end
    end)
end

button.Activated:Connect(function()
    clicked = 0
    spawnRemote:FireServer() -- tell server to spawn brainrot
    spawnButton()
end)
tender wraith
trail thorn
tender wraith
trail thorn