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
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
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