This script was fixed by Zafirua and surprisingly it didn't work. This time I added the Output, along with the picture of the studio of what I have on my Workspace, and the script fixed by Zafirua, which I want to say thank you so much!
https://imgur.com/CejNXXc
-- [Declaration Section] local Up = script.Parent.Up; local Down = script.Parent.Down; local Left = script.Parent.Left; local Right = script.Parent.Right; --\\ Variables local UpOn = false; local DownOn = false; local LeftOn = false; local RightOn = false; -- [Processing Section] local function On_Clicked () if not UpOn then UpOn = true; Up.CFrame = Up.CFrame + Vector3.new(0, -0.09 ,0); wait() Up.CFrame = Up.CFrame + Vector3.new(0, 0.09 ,0); UpOn = false; elseif not DownOn then DownOn = true; Down.CFrame = Down.CFrame + Vector3.new(0, -0.09 ,0); wait() Down.CFrame = Down.CFrame + Vector3.new(0, 0.09 ,0); DownOn = false; elseif not LeftOn then LeftOn = true; Left.CFrame = Left.CFrame + Vector3.new(0, -0.09 ,0); wait() Left.CFrame = Left.CFrame + Vector3.new(0, 0.09 ,0); LeftOn = false; elseif not RightOn then RightOn = true; Right.CFrame = Right.CFrame + Vector3.new(0, -0.09 ,0); wait() Right.CFrame = Right.CFrame + Vector3.new(0, 0.09 ,0); RightOn = false; else return; end; end; -- [Connecting Section] script.Parent.ClickDetector.MouseClick:Connect(On_Clicked);
Output
22:39:58.389 - ClickDetector is not a valid member of Model
22:39:58.392 - Stack Begin
22:39:58.393 - Script 'Workspace.RemoteControl.Script', Line 53
22:39:58.393 - Stack End
-- Try script.Parent:WaitForChild("ClickDetector").MouseClick:Connect(On_Clicked); -- If it errors, or not work. It means, clickdetector is being called too early. Try fixing it using a wait, find, or any other useful ones.
Should you try?
-- [Declaration Section] local Up = script.Parent.Up; local Down = script.Parent.Down; local Left = script.Parent.Left; local Right = script.Parent.Right; --\\ Variables local UpOn = false; local DownOn = false; local LeftOn = false; local RightOn = false; -- [Processing Section] local function On_Clicked (which) if which == "Up" then UpOn = true; Up.CFrame = Up.CFrame + Vector3.new(0, -0.09 ,0); wait() Up.CFrame = Up.CFrame + Vector3.new(0, 0.09 ,0); UpOn = false; elseif which == "Down" then DownOn = true; Down.CFrame = Down.CFrame + Vector3.new(0, -0.09 ,0); wait() Down.CFrame = Down.CFrame + Vector3.new(0, 0.09 ,0); DownOn = false; elseif which == "Left" then LeftOn = true; Left.CFrame = Left.CFrame + Vector3.new(0, -0.09 ,0); wait() Left.CFrame = Left.CFrame + Vector3.new(0, 0.09 ,0); LeftOn = false; elseif which == "Right" then RightOn = true; Right.CFrame = Right.CFrame + Vector3.new(0, -0.09 ,0); wait() Right.CFrame = Right.CFrame + Vector3.new(0, 0.09 ,0); RightOn = false; else return; end; end; -- [Connecting Section] Up.ClickDetector.MouseClick:Connect(On_Clicked("Up") Down.ClickDetector.MouseClick:Connect(On_Clicked("Down") Left.ClickDetector.MouseClick:Connect(On_Clicked("Left") Right.ClickDetector.MouseClick:Connect(On_Clicked("Right")