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

Can i change velocity with ClickDetector?

Asked by 4 years ago

I am new to scripting and i am trying to build a train and use a tactic for velocity to make it move. I made this code:

local clickDetector = workspace.Red.ClickDetector

    function onMouseClick()
        game.Workspace.track_boy.Velocity = Vector3.new(-25,0,0)
        game.Workspace.track_man.Velocity = Vector3.new(-25,0,0)
    end

    game.clickDetector.MouseClick:connect(onMouseClick)

But it doesn't work.. Can someone tell me what's the problem or should i try something else?

0
Your connection line says game.clickDetector.. I'm sure you want to access the Red within workspace for that. Also, what is track_boy and track_man, what type of objects are they Shawnyg 4330 — 4y
0
If they're just BaseParts, you'll want to use a BodyMover Shawnyg 4330 — 4y
0
Aha, i see koce1234 0 — 4y

Answer this question