Hello developers,
I want to make a button where the player can click it and sit them down in a rocket.
I’m having a problem where when the character will sit in a seat when the event is fired.
This haves nothing to do with the button, but something to do when firing a event along with the vehicle seat
– CLIENT
local player = game.Players.LocalPlayer
local character = player.Character
script.Parent.MouseButton1Click:Connect(function()
-- disable jump
game:GetService("ContextActionService"):BindActionAtPriority("LockSeat", function()
return Enum.ContextActionResult.Sink
end, false, Enum.ContextActionPriority.High.Value, Enum.PlayerActions.CharacterJump)
-- make the ui invisible
script.Parent.Visible = false
-- get our rocket
local rocket = game.Workspace:FindFirstChild(game.Players.LocalPlayer.Name.."'s rocket")
-- check if the rocket is a valid member of workspace
if rocket then
local vehicleSeat = rocket:FindFirstChild("VehicleSeat")
-- teleport the character to the rocket.VehicleSeat
character.HumanoidRootPart.CFrame = vehicleSeat.CFrame + Vector3.new(0,3,0)
-- sit the character because I cant do it in the client
wait(1)
-- fire the event that allows our player to sit, I also want to fire the server with the vehicle seat
game.ReplicatedStorage:FindFirstChild("Events").SitCharacter:FireServer(vehicleSeat)
end
end)
– SERVER
game.ReplicatedStorage:FindFirstChild("Events").SitCharacter.OnServerEvent:Connect(function(player, seat)
-- sit the player down
seat:Sit(player.Character.Humanoid)
end)
I cannot sit the player down in the client, I’m trying to get it to work in the server.
I get this error:
How can I fix this?

Is it possible to sit the player in the client? Because it wont work for me in the client.