Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

Attempting to locate vehicle with Player's name in workspace?

Asked by 3 years ago

My problem is getting a script (Located in PlayerGui) to find a vehicle in workspace (Uses A-Chassis so it's named [PlayerName]'s Car). Any help would be appreciated, as my scripting capabilities are not at this level yet, and if you have any useful tutorials regarding this topic, please share.

0
Please provide the relevent scripts. Benbebop 1049 — 3y

1 answer

Log in to vote
0
Answered by
SteamG00B 1633 Moderation Voter
3 years ago
Edited 3 years ago

I would've preferred that you attempt this, but considering how easy this is, I will answer it anyway.

local player = game.Players.LocalPlayer
local x = player.Name
local vehicle = workspace["[" .. x .. "]'s Car"]

To concatenate strings, you use two dots like I have above, and because the vehicle's name also contains a space in it, the normal dot operator won't work so you would have to do workspace["name"] without a dot operator.

Since this answers your question, mark it as the accepted answer. Also read this https://scriptinghelpers.org/about before asking your next question.

Ad

Answer this question