Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how do i make a script that detects if a space is occupied when cloning?

Asked by 7 years ago
Edited 6 years ago

maybe one that detects if four sides are touching, i want to make an infinite baseplate script that uses cframe to clone the baseplates when they are stepped on. i want to stop them from overlapping because when i step on the baseplate i just left the one made by the new baseplate clones itself.

baseplate= script.Parent function copy(part) 
baseplate = script.Parent:Clone() 
baseplate.Parent = game.Workspace baseplate.CFrame = CFrame.new(baseplate.CFrame.X+100, baseplate.CFrame.Y, baseplate.CFrame.Z+100) baseplate = script.Parent:Clone() 
baseplate.Parent = game.Workspace baseplate.CFrame = CFrame.new(baseplate.CFrame.X+100, baseplate.CFrame.Y, baseplate.CFrame.Z) baseplate = script.Parent:Clone() 
baseplate.Parent = game.Workspace baseplate.CFrame = CFrame.new(baseplate.CFrame.X, baseplate.CFrame.Y, baseplate.CFrame.Z+100) 
baseplate = script.Parent:Clone() baseplate.Parent = game.Workspace baseplate.CFrame = CFrame.new(baseplate.CFrame.X+100, baseplate.CFrame.Y, baseplate.CFrame.Z-100) baseplate = script.Parent:Clone() 
baseplate.Parent = game.Workspace baseplate.CFrame = CFrame.new(baseplate.CFrame.X-100, baseplate.CFrame.Y, baseplate.CFrame.Z+100) baseplate = script.Parent:Clone()
baseplate.Parent = game.Workspace baseplate.CFrame = CFrame.new(baseplate.CFrame.X-100, baseplate.CFrame.Y, baseplate.CFrame.Z) baseplate = script.Parent:Clone() 
baseplate.Parent = game.Workspace baseplate.CFrame = CFrame.new(baseplate.CFrame.X, baseplate.CFrame.Y, baseplate.CFrame.Z-100) 
baseplate = script.Parent:Clone() 
baseplate.Parent = game.Workspace baseplate.CFrame = CFrame.new(baseplate.CFrame.X-100, baseplate.CFrame.Y, baseplate.CFrame.Z-100)
``if baseplate.Touched then 
script:Destroy()
 end
 end 
baseplate= script.Parent
baseplate.Touched:connect (copy)






-- i also tried 
baseplate= script.Parent
function copy(part)
    local ray = Ray.new(Vector3.new(100,0,100))
    local part, endPoint = workspace:FindPartOnRay(ray)
    if part then 
        part:destroy() 
        end
baseplate = script.Parent:Clone()
baseplate.Parent = game.Workspace
baseplate.CFrame = CFrame.new(baseplate.CFrame.X+100, baseplate.CFrame.Y, baseplate.CFrame.Z+100)
local ray = Ray.new(Vector3.new(100,0,0))
    local part, endPoint = workspace:FindPartOnRay(ray)
    if part then 
        part:destroy() 
        end
baseplate = script.Parent:Clone()
baseplate.Parent = game.Workspace
baseplate.CFrame = CFrame.new(baseplate.CFrame.X+100, baseplate.CFrame.Y, baseplate.CFrame.Z)
local ray = Ray.new(Vector3.new(0,0,100))
    local part, endPoint = workspace:FindPartOnRay(ray)
    if part then 
        part:destroy() 
        end
baseplate = script.Parent:Clone()
baseplate.Parent = game.Workspace
baseplate.CFrame = CFrame.new(baseplate.CFrame.X, baseplate.CFrame.Y, baseplate.CFrame.Z+100)
local ray = Ray.new(Vector3.new(0,0,-100))
    local part, endPoint = workspace:FindPartOnRay(ray)
    if part then 
        part:destroy() 
        end
baseplate = script.Parent:Clone()
baseplate.Parent = game.Workspace
baseplate.CFrame = CFrame.new(baseplate.CFrame.X+100, baseplate.CFrame.Y, baseplate.CFrame.Z-100)
local ray = Ray.new(Vector3.new(-100,0,100))
    local part, endPoint = workspace:FindPartOnRay(ray)
    if part then 
        part:destroy() 
        end
baseplate = script.Parent:Clone()
baseplate.Parent = game.Workspace
baseplate.CFrame = CFrame.new(baseplate.CFrame.X-100, baseplate.CFrame.Y, baseplate.CFrame.Z+100)
local ray = Ray.new(Vector3.new(-100,0,0))
    local part, endPoint = workspace:FindPartOnRay(ray)
    if part then 
        part:destroy() 
        end
baseplate = script.Parent:Clone()
baseplate.Parent = game.Workspace
baseplate.CFrame = CFrame.new(baseplate.CFrame.X-100, baseplate.CFrame.Y, baseplate.CFrame.Z)
local ray = Ray.new(Vector3.new(0,0,-100))
    local part, endPoint = workspace:FindPartOnRay(ray)
    if part then 
        part:destroy() 
        end
baseplate = script.Parent:Clone()
baseplate.Parent = game.Workspace
baseplate.CFrame = CFrame.new(baseplate.CFrame.X, baseplate.CFrame.Y, baseplate.CFrame.Z-100)
local ray = Ray.new(Vector3.new(-100,0,-100))
    local part, endPoint = workspace:FindPartOnRay(ray)
    if part then 
        part:destroy() 
        end
baseplate = script.Parent:Clone()
baseplate.Parent = game.Workspace
baseplate.CFrame = CFrame.new(baseplate.CFrame.X-100, baseplate.CFrame.Y, baseplate.CFrame.Z-100)
if baseplate.Touched then
script:Destroy()
end
end
baseplate= script.Parent
baseplate.Touched:connect (copy)



0
Can you include the script User#5423 17 — 7y
0
oh my gosh so much math hiimgoodpack 2009 — 7y
0
why are you checking if a property that contains an event is nil hiimgoodpack 2009 — 7y
0
i where did i check if something was nil SLENDERMANCLONE -27 — 7y

Answer this question