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:
01 | local timing = 10 |
02 | gui = script.Parent.Parent.door.SurfaceGui.TextLabel |
03 |
04 | gui.Text = "10..." |
05 | for i = 0 , 9 do |
06 | wait( 1 ) |
07 | timing = timing - 1 |
08 | gui.Text = timing.. "..." |
09 | end |
10 | game.Workspace.door.CanCollide = false |
11 | gui.Text = "GO!!!" |
12 | while true do |
13 | if script.Parent.CFrame > = script.Parent.Parent.Backer.CFrame then |
14 | script.Parent.CFrame = CFrame.new( 60.5 , 31 , - 39 ) break |
15 | end |
16 | script.Parent.CFrame = script.Parent.CFrame * CFrame.new(- 1 , 0 , 0 ) |
17 | wait( 0 ) |
18 | 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
Try changing the end at line 15 to an else and adding an end after line 17
01 | local timing = 10 |
02 | gui = script.Parent.Parent.door.SurfaceGui.TextLabel |
03 |
04 | gui.Text = "10..." |
05 | for i = 0 , 9 do |
06 | wait( 1 ) |
07 | timing = timing - 1 |
08 | gui.Text = timing.. "..." |
09 | end |
10 | game.Workspace.door.CanCollide = false |
11 | gui.Text = "GO!!!" |
12 | while true do |
13 | if script.Parent.CFrame > = script.Parent.Parent.Backer.CFrame then |
14 | script.Parent.CFrame = CFrame.new( 60.5 , 31 , - 39 ) break |
15 | else |
16 | script.Parent.CFrame = script.Parent.CFrame * CFrame.new(- 1 , 0 , 0 ) |
17 | wait( 0.1 ) --make the wait a bit longer so the block doesn't go to fast and to not crash your game |
18 | end |
19 | end |
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