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

My script is moving the bottom brick all the way up. Can someone help me?

Asked by 7 years ago

I actually have two questions: 1, (i know this is a stupid question) what is a snack break? 2, this script i wrote up isn't working for some reason. Every time i touch the brick, the bottom brick flies all the way up and changes the Y value to 4. Can someone help me?

script.Parent.Bottom1.Touched:connect(function()
    local humanoid = game.Players.LocalPlayer.Character.Humanoid
    local plr = game.Players.LocalPlayer
    local prisoner = game.Teams.Prisoner
    if (humanoid ~= nil) and plr.Team == prisoner  then
        local top = script.Parent.Top1
        local glass = script.Parent.Glass
        local bottom = script.Parent.Bottom1
        for i = 386.765, 391.445, 0.9 do
            top.Position = Vector3.new(i,-9.475,-56.43)
            bottom.Position = Vector3.new(i, -16.95, -56.43)
            glass.Position = Vector3.new(i,-12.485,-56.415)
            wait()
        end
        wait(0)
        script.Disabled = true
    end
end)
0
Use CFrame instead of Position. Thats all. TickTockTheory 106 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

Here is your revised script. Let me know if it works.

script.Parent.Bottom1.Touched:connect(function()
    local humanoid = game.Players.LocalPlayer.Character.Humanoid
    local plr = game.Players.LocalPlayer
    local prisoner = game.Teams.Prisoner
    if (humanoid ~= nil) and plr.Team == prisoner  then
        local top = script.Parent.Top1
        local glass = script.Parent.Glass
        local bottom = script.Parent.Bottom1
        for i = 386.765, 391.445, 0.9 do
            top.CFrame = CFrame.new(i,-9.475,-56.43)
            bottom.CFrame = CFrame.new(i, -16.95, -56.43)
            glass.CFrame = CFrame.new(i,-12.485,-56.415)
            wait()
        end
        wait(0)
        script.Disabled = true
    end
end)

0
yes it worked, thanks! but i have one more problem: i want the 3 bricks to go to the original place, but they wont move back. can use help me? supercoolboy8804 114 — 7y
0
Just plug in the original positions after a wait(2) TickTockTheory 106 — 7y
0
Why did I get a down vote on this? I fixed your original problem TickTockTheory 106 — 7y
0
i didnt vote down, someone else must have voted you down supercoolboy8804 114 — 7y
0
Oh okay TickTockTheory 106 — 7y
Ad

Answer this question