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

Platform not changing CFrame? [Unanswered]

Asked by
yoshi8080 445 Moderation Voter
8 years ago

I used the script that was my answer, but didn't solve my problem

local platform = workspace.Platform
local stop1, stop2 = workspace.Stop1 or workspace.Stop2
stop1.Touched:connect(function(hit)
    if hit==platform then
        print("Stop1 touched the platform")
       hit.CFrame = platform.CFrame * CFrame.new(0,0,.1)
end
end)
stop2.Touched:connect(function(hit)
 if hit==platform then
        print("Stop1 touched the platform")
       hit.CFrame = platform.CFrame * CFrame.new(0,0,-.1)
end
end)

The problem is that it won't move

0
Touched doesn't fire if you change it's CFrame and goes to a part. Discern 1007 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

"onTouched" is not a built in function. And if it was, you still didn't call it in your code. You also don't need a loop, and you can't add a Vector3 to a CFrame. Try studying this code:

local platform = workspace.Platform
local stop1, stop2 = workspace.Stop1, workspace.Stop2

platform.Touched:connect(function(hit)
    if hit==stop1 then
        print("Stop1 touched the platform")
        hit.CFrame = platform.CFrame * CFrame.new(0,0,10)
    elseif hit==stop2 then
        print("Stop2 touched the platform")
        hit.CFrame = platform.CFrame * CFrame.new(0,0,-10)
    end
end)
0
What about it moving towards the part? yoshi8080 445 — 8y
0
You want the part that touches the platform to move more toward the platform? CodingEvolution 490 — 8y
0
I want the platform to move towards the stop1 and moves back towards the stop2 yoshi8080 445 — 8y
Ad

Answer this question