#can someone help me with my code?

1 messages · Page 1 of 1 (latest)

hasty prawn
#
local touchp = game.Workspace.touchpart
local color = 0

touchp.Touched:Connect(function()
    touch = true
end)

touchp.TouchEnded:Connect(function()
    touch = false
end)

while true do
    while touch do
        touchp.Color = Color3.fromHSV(color, 1, 1)
        task.wait(0.05)
        color = color + 0.01
        if color >= 1 then
            task.wait(0.05)
            color = 0
        end
    end
end    ```

It's a normal script sitting in ServerScriptService but I can't see it doing anything in game
hollow widget
#

then if you get prints you can check for other issues

hasty prawn
#

will do

#

"Script timeout, exhausted allowed execution time"

#

so the wait in between the colour changes has to be longer no?

hollow widget
#

do this

#
local touch = false
local touchp = game.Workspace.touchpart
local color = 0

touchp.Touched:Connect(function()
    touch = true
end)

touchp.TouchEnded:Connect(function()
    touch = false
end)

while touch do
    touchp.Color = Color3.fromHSV(color, 1, 1)
    task.wait(0.05)
    color = color + 0.01
    if color >= 1 then
        task.wait(0.05)
        color = 0
    end
end
#

now there is only one while loop

hasty prawn
#

still nothing

#

does the folder matter at all

narrow jay
hasty prawn
#

in the if statement or the loop

narrow jay
#

Loop

hasty prawn
verbal perchBOT
#

studio** You are now Level 1! **studio

narrow jay
#

Function*

hasty prawn
#

why would i is it not a loop

narrow jay
#

You can literally use functions on a loop

hasty prawn
#
local touchp = game.Workspace.touchpart
local color = 0

touchp.Touched:Connect(function()
    touch = true
end)

touchp.TouchEnded:Connect(function()
    touch = false
end)

local function hi()
    while touch do
        touchp.Color = Color3.fromHSV(color, 1, 1)
        task.wait(0.05)
        color = color + 0.01
        if color >= 1 then
            task.wait(0.05)
            color = 0
        end
        task.wait(0.05)
    end
end

while true do
    hi()
end```
#

sorry if i misunderstood something im still quite new

latent lintel
#

Bro ur purpose is explode your pc

#

Why there is 2 loop