Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does my TouchConnect script not register a part colliding with a box?

Asked by 5 years ago

This is my script, which should make a wave go upwards, until it's out of a Checkbox. For some reason it doesn't register the wave colliding with the box, so the script doesn't work...

I also used a CFrame script to animate the wave. Could I make that animation more efficient in any way?

local Tsunami = script.Parent
local Checkbox1  = game.Workspace.Checkbox1
local touched = false

local StartPosition = Vector3.new(-9.841, -11.092, 675.948)

Tsunami.Touched:Connect(function(hitpart)
    if hitpart == Checkbox1 then 
        touched = true
        print("TEST-SUCCES")
            while touched == true do
                wait(.01)
                Tsunami.CFrame = CFrame.new(StartPosition) + Vector3.new(0,15*i,0) 
                Tsunami.CFrame = Tsunami.CFrame * CFrame.Angles(math.rad (0), (4.71238898038), (0));  -- The wave keeps otherwise keeps facing the wrong direction
            end
    end
end)
0
touched is never set back to false, could that be the problem? DeceptiveCaster 3761 — 5y
0
That's not the problem, I just tested that :( ZURUgamer 7 — 5y
0
I tested your code and you have not defined i? TheGreenSuperman 85 — 5y
0
what have i not defined? ZURUgamer 7 — 5y
View all comments (3 more)
0
The variable >> i << NewGPU 36 — 5y
0
Dude, do you defined the i variable in the script? Because using it at line 13: ..Vector3.new(0,15*i... <there Miniller 562 — 5y
0
OHHH, i used that before in "for i do" ZURUgamer 7 — 5y

Answer this question