So in this function I have (which I have previously asked a question about) I find the player who hit a brick and then find their bus in the workspace. However I recieve an error trying to concatenate this string.
Detector = script.Parent function onTouch(part) local player = game.Players:GetPlayerFromCharacter(part) local bus = Workspace:FindFirstChild(player.."'s Car") -- do stuff end Detector.Touched:connect(onTouch)
The model in the workspace is called "Player 1's Car" (in test mode) but the function breaks when I do this. Can anyone see why?
local player = game.Players:GetPlayerFromCharacter(part)
That is trying to get the player from a limb. Just change:
local player = game.Players:GetPlayerFromCharacter(part.Parent)
But don't forget to check if it really is a character, search for a Humanoid.