Hey developers,
I am trying to make a E to get in car script, but it has not gone as expected.
Problem:
https://gyazo.com/f648682745bf0beb699a14d9b86f9689
How do I make this for one player with a server-sided script?
Code:
-- Removed.
Hey developers,
I am trying to make a E to get in car script, but it has not gone as expected.
Problem:
https://gyazo.com/f648682745bf0beb699a14d9b86f9689
How do I make this for one player with a server-sided script?
Code:
-- Removed.
Hello,
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
local PlayerInTheCar = [DO_YOUR_CODE_TO_CHANGE_THIS_VARIABLE_TO_THE_PLAYER_INSIDE]
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!
@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?
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.
Hello,
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!
-- Removed.
Error:
https://gyazo.com/cce58582af412b89ea1c64f08c5d64cf
Line:
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?
Hello,
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!