Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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)

1 comment

0

Use CFrame instead of Position. Thats all.

1 answer

✓ Accepted answer

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)

5 comments

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?

0

Just plug in the original positions after a wait(2)

0

Why did I get a down vote on this? I fixed your original problem

0

i didnt vote down, someone else must have voted you down

0

Oh okay

This discussion is preserved as it was. New answers, comments, and votes are closed.