Hello!
I’m trying to teleport a model to a certain location in my game. I’m curious how to go about doing this successfully, In my “Locations” is a Folder with a CFrame Value and a StringValue with the position of where I want it to be teleported to. The “model” Has an NPC, Model, and a Union. I don’t think that will matter but, figured I’d add it just in case. If you’re able to help, thank you! If not, I hope the rest of your day goes great!
wait(5)
local Locations = game.ServerStorage.WarehouseNPCLocation:GetChildren()
local Location
local model = workspace.WarehouseClaim
Location = Locations[math.random(1,#Locations)]
model:SetPrimaryPartCFrame(tonumber(Location.Position.Value))
(if I can provide something more to help you, please let me know I’d be happy to do so!
local Locations = game.ServerStorage.WarehouseNPCLocation:GetChildren()
local model = workspace.WarehouseClaim
Location = Locations[math.random(1,#Locations)]
model:SetPrimaryPartCFrame(CFrame.new(Location.Value))
"Model:SetPrimaryCFrame() failed because no PrimaryPart has been set, or the PrimaryPart no longer exists. Please set Model.PrimaryPart before using this.
With this code:
local Locations = game.ServerStorage.WarehouseNPCLocation:GetChildren()
local Location
local model = workspace.WarehouseClaim
Location = Locations[math.random(1,#Locations)]
model:SetPrimaryPartCFrame(CFrame.new(Location.Value))