#help with model position when event finished
1 messages · Page 1 of 1 (latest)
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)
This feels ai generated i cant lie, but where does the error occur?
i had bugs made ai help me and gave me a more stable code but the script im tryna send is too long
eh, fair enough but where does the problem/error occur?
i dont know i tried debugging but either its remote events or the server sided script