Why moving block isnt working

Where should I put that thing?

Yeah my bad, but even that I changed it, it still doesn’t work

You need to replace

local UIS = game:GetService("UserInputService")

UIS.InputBegan:Connect(function(input)
	if input == Enum.KeyCode.E then
		script.Parent.RemoteEvent:FireServer("goUP")
	end
end)

In the LOCAL script
with

game:GetService("RunService").RenderStepped:Connect(function()
   if game:GetService("UserInputService"):IsKeyDown(Enum.KeyCode.E) == true then
      script.Parent.RemoteEvent:FireServer("goUP")
   end
end
1 Like

Still nothing

(30 words words words)

Tell me what everything is parented under please.

1 Like

Of I figured it out. Aswell as what I mentioned previously you forgot to connect the remote event to anything.

1 Like

Alright I was wrong in my previous post but this should be the solution to your problem.

SERVER

local Players = game:GetService("Players")
local sited = nil
local part = script.Parent.Part
local movement = 'none'

local function goup(Part)
	Part.Position += Vector3.new(0,1,0)
end

local function godown(Part)
	Part.Position -= Vector3.new(0,1,0)
end

script.Parent.VehicleSeat:GetPropertyChangedSignal("Occupant"):Connect(function()
	local humanoid = script.Parent.VehicleSeat.Occupant
	if humanoid then
		local character = humanoid.Parent
		local player = Players:GetPlayerFromCharacter(character)
		if player then
			sited = player
			if sited == nil then
				return
			end
		end
	else
		sited = nil
	end
end)

script.Parent.RemoteEvent.OnServerEvent:Connect(function(player, move)
	if player == sited then
		print(movement)
		movement = move
		if movement == "goUP" then
			goup(part)
		end
		if movement == "goDOWN" then
			godown(part)
		end
	end
end)

LOCAL

local lastTick = tick()

game:GetService("RunService").Heartbeat:Connect(function()
	local move = 'none'
	if game:GetService("UserInputService"):IsKeyDown(Enum.KeyCode.E) == true then
		move = "goUP"
	end
	if tick() > lastTick + 0.05 then
		lastTick = tick()
		script.Parent.RemoteEvent:FireServer(move)
	end
end)
1 Like

Idk am I doing something wrong, but it doesnt work

Please show us a screenshot of where your scripts are located in your Workspace window as @RayK_iv asked a couple hours ago.

1 Like

Still need help

(30 wordswords)

Put a print statement in each section to find out where the issue is.
For example in your Local Script put

	if game:GetService("UserInputService"):IsKeyDown(Enum.KeyCode.E) == true then
		move = "goUP"
        print("E pressed")
	end

I just noticed you are checking in the GetPropertyChanged function to see

		if player then        -- so checking to see if player is true
			sited = player    --making sited = player only if the above line is true
			if sited == nil then   --if sited == nil that means 2 lines above didn't find player = true?
				return -- so you finish with sited == nil
			end
		end
	else
		sited = nil  --you're setting sited to nil if there is a humanoid
	end

Basically in the above function you are checking for a player if the VehicleSeat Property changes then setting sited to player, and then immediately setting sited to nil. That doesn’t make sense.

2 Likes

Not the best way to do this, it is as basic an example as you can get but at least it works flying the seat around.

FlyingSeat_Baseplate.rbxl (45.1 KB)

Easy fix the local script doesn’t have a player. Its just in workspace. Put a spawn pad down. Then put the model with the seat in starterplayer → startercharacterscripts

1 Like

I already addressed all that in post #11

2 Likes

What print outputs are you getting when the player sits in the VehicleSeat?

1 Like

I will check after school

Ghbbbchhcjv

I added so when player sits it prints and it works. When you press E, it doesnt print anything (yes, as @RayK_iv said, I put localscript into startercharacterscripts)

Did you check my place in the reply in post #17?
It works and shows how the scripts and parts should be organised to work

Yes I have checked it. I forgot to ask whats the difference between that script and mine (dont tell me that it is more detailed)

You needed to put the ENTIRE model in startercharacterscripts not just the local script.