I want to make a code that when the brick is touched, a car appears infront of the players character, but right now my code isnt working. May you please help me? Also, if my code is bad sorry its because I started scripting 5 days ago... :/
Code:
local crvpart = game.Workspace.CRV
local v = game.ServerStorage["CR-V"]
local character = game.Players.LocalPlayer.Character
crvpart.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local vly = v:Clone()
vly.Parent = game.Workspace
vly:MoveTo(character.UpperTorso.Position + Vector3.new(0,0,10))
end
end)

1 comment
Are you using LocalScript? LocalPlayer can only work through LocalScript.