Ok so i have vehicles and the script the gui says buy vehicle for 100 it purchases nothing happens... I need to know how to teleport a model infront of a players torso or anything but i know that i need to put the stuff in the lightning i just need someone to get me the script of how to make it teleport once the button is pressed.
How do you teleport a model infront of a player??
1 answer
workspace.FilteringEnabled == true, or naw?
I'm going to assume that it's false. Since you're dealing with a model here, I'd first deal with its PrimaryPart if you haven't already. It's pretty cool.
Run this in the command line:
Car = game.ServerStorage.Enter_Your_Car_Name_Here.PrimaryPart Car.PrimaryPart = Car.Engine
You must set the PrimaryPart to any part that's inside your car (whether it is the car's child or descendant) to "teleport" the car. The PrimaryPart property allows you to use these two methods: :MoveTo() and :SetPrimaryPartCFrame()
Note that I defined your car in game.ServerStorage. Please get into the habit of placing your stored models in game.ServerStorage, because that's what it's meant for. Storage.
-- LocalScript
Player = game.Players.LocalPlayer
Leaderstats = Player:WaitForChild("leaderstats")
Money = Leaderstats:WaitForChild("Money")
Character = Player.Character or Player.CharacterAdded:wait()
HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
Car = game.ServerStorage:WaitForChild("Enter_Your_Car_Name_Here")
Button = script.Parent
Button.MouseButton1Click:connect(function()
if Money.Value >= 100 then
local newCar = Car:Clone()
newCar.Parent = workspace
newCar:SetPrimaryPartCFrame(HumanoidRootPart.CFrame * CFrame.new(0, 0, -10))
-- Teleport the newCar to 10 studs in front of the character
Money.Value = Money.Value - 100
end
end)
This is the basic layout. This is could've been scripted better, but this is to give you the general idea.
If FilteringEnabled is set to true, then consider learning and using these objects.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
You have the script, but you didn't provide it...?