Issues with code

Hey developers,

I am trying to make a E to get in car script, but it has not gone as expected.

How do I make this for one player with a server-sided script?


-- Removed.


The easiest way to create an E to enter, would be to Proximity Prompts | Roblox Creator Documentation. This works similar to a click detector.

You can then use the Humanoid | Roblox Creator Documentation function of the seat to put the player’s char into the seat.

Hope this helps!

Use Proximity Prompt for the E to click. The tutorial on how to use Proximity Prompts is in the link i sent.

You can use variables such as:

local SomeoneIsInTheCar = false

When someone is not in the car, and when someone is in the car

local SomeoneIsInTheCar = true

to deactivate the proximity prompt, and register in a variable of who is in the car.

And use:

stated by VeosRob in the post up here, to make the player sit in the car’s seat. Hope this helped! :wink:

@VeosRob @0secretlyninja Yeah, I used both of those in my code already, but how can I get the player who has sat in the seat?

You can use the TriggerEnded function, as stated by a user of the DevForum down here:

1 Like

Do a variable for example local LastPlayer = nil, when a player sits change the variable’s content to the player’s name, and when someone sits in the car it will automatically change to the last player who sat in the seat’s name.


Similar to what @DaffyDavinko said, you could add an Instance Attributes | Roblox Creator Documentation to the seat and then change the property to who is currently sitting in the seat. i.e. when the Humanoid | Roblox Creator Documentation is being run, change the value of the property to the name of the player in the seat.

I hope that helps!

@DaffyDavinko @VeosRob

-- Removed.



PlayerSitting.Parent.Character.HumanoidRootPart.CFrame = Seats.Parent.Body.LeftSide.CFrame

How do I make PlayerSitting not nil?

Can you give me an example of how Instance Attributes work?


To add an attribute to an instance, you can press this button.

You can then set the name and value type

After doing that, it will show up as a normal property in the instance.

Hope this helps!