local Prompt = script.Parent
local jeep = game.ServerStorage:WaitForChild("Jeep")
Prompt.Triggered:Connect(function()
local cloneJeep = jeep:Clone()
local TargetPosition = Vector3.new(146.5, 42.525, 169.5)
cloneJeep:PivotTo(CFrame.new(TargetPosition))
cloneJeep.Parent = workspace
end)
#How do I check if there was already jeep within the same position?
1 messages · Page 1 of 1 (latest)
store all the positions in a table
but also your only going to have 1 able to spawn in that case because your spawning it in a set position
if you know how to raycast, you could use that to see if there's a jeep below a certain point
or, use :GetPartsInPart to find jeep parts
local parts = workspace:GetPartBoundsInBox(CFrame.new(TargetPosition), jeep:GetExtentsSize())
local jeepFound = false
for _, part in parts do
if part:FindFirstAncestorWhichIsA("Model").Name == jeep.Name then
jeepFound = true
break
end
end
^ that would work
though, i think PartsInPart is a bit easier to use + accounts for rotation/is easier to adjust, generally
how to use tha
theres probably a better way to check if a model is a jeep
thats's new for me
tbh, just FindFirstAncestor( jeep name )
similar to what he's done up there
apolocheese for stealing your thunder @deft apex but adjusted code:
local parts = workspace:GetPartsInPart(workspace.JeepSpawnBox)
local jeepFound = false
for _, part in parts do
if part:FindFirstAncestor(jeepname) then
jeepFound = true
break
end
end
if jeepFound then
--blah blah blah
end
something like that
whered you get jeepspawnbox from
made it up
you'd add a jeep spawn part and make it transparent etc to use as the checking box
to be clear @hard osprey
and call it JeepSpawnBox or adjust the code for the name of it or w/e
ok thanks 👍
Life would be pain and laggy without :getpartsinpart()