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

How can i fix this moving and resetting wall script?

Asked by 9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

Hi im working on a game where you have to run away from a wall whilst doging obstacles but i am really stuck with sorting out the pusher block this is my code so far:

local timing = 10
gui = script.Parent.Parent.door.SurfaceGui.TextLabel

gui.Text = "10..."
for i = 0,9 do
    wait(1)
    timing = timing - 1
    gui.Text = timing.."..."
end
game.Workspace.door.CanCollide = false
gui.Text = "GO!!!"
while true do
    if script.Parent.CFrame >=  script.Parent.Parent.Backer.CFrame then
        script.Parent.CFrame = CFrame.new(60.5, 31, -39) break
    end
    script.Parent.CFrame = script.Parent.CFrame * CFrame.new(-1,0,0)
    wait(0)
end

the for loop is to change the value on the GUI but its working fine its just the door right now all i have oticed is the if statement (p.s. giving me any improvements to the script will help thanks and i keep getting this error " Walkspeed 25.Pusher.Move:29: attempt to compare two userdata values" if this code cannot be figured out i want to know a way i could make it so the pusher resets for each minigame) if it helps i have opened my place and left the link here

2 answers

Log in to vote
0
Answered by 9 years ago

Try changing the end at line 15 to an else and adding an end after line 17

local timing = 10
gui = script.Parent.Parent.door.SurfaceGui.TextLabel

gui.Text = "10..."
for i = 0,9 do
 wait(1)
 timing = timing - 1
    gui.Text = timing.."..."
end
game.Workspace.door.CanCollide = false
gui.Text = "GO!!!"
while true do
    if script.Parent.CFrame >=  script.Parent.Parent.Backer.CFrame then
        script.Parent.CFrame = CFrame.new(60.5, 31, -39) break
    else
        script.Parent.CFrame = script.Parent.CFrame * CFrame.new(-1,0,0)
    wait(0.1) --make the wait a bit longer so the block doesn't go to fast and to not crash your game
end
end
0
thx and the block doesnt go fast at all with wait(0) turtle2004 167 — 9y
0
didn't work :/ turtle2004 167 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

time = 10 MainGui = game.Workspace.Brick.SurfaceGui.TextLabel door = game.Workspace.door

value = time while value >= 0 do value = value -1 MainGui.Text = ""..value.."...." wait(1) end

door.CanCollide = false MainGui.Text = "GO!"

while true do if script.Parent.CFrame >= script.Parent.Parent.Backer.CFrame then script.Parent.CFrame = CFrame.new(60.5%1, 31, -39*1) break else script.Parent.CFrame = CFrame.new(script.Parent.CFrame) * CFrame.new(-1,0,0) wait(0.1) end end

Answer this question