Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function GetSpawnPoint(map,mapMaxHeight)
- local outside,raypos,raydir;
- local modelSize = map.Size;
- local foundPoint;
- local vectorCheck;
- print(mapMaxHeight)
- while true do
- wait()
- --outside = map:GetModelCFrame() * CFrame.new(math.random(-modelSize.X/2,modelSize.X/2),-modelSize.Y,math.random(-modelSize.Z/2,modelSize.Z/2));
- outside = map.CFrame * CFrame.new(math.random(-(modelSize.X/2),modelSize.X/2),mapMaxHeight,math.random(-(modelSize.Z/2),modelSize.Z/2));
- raypos = outside.p;
- raydir = ((outside.p - Vector3.new(0,-(mapMaxHeight*2),0)) - outside.p).unit * 9999;
- --[[local tBlock = Instance.new("Part", workspace); --Test to see where the ray origin is
- tBlock.Anchored = true
- tBlock.BrickColor = BrickColor.new("Bright green");
- tBlock.Size = Vector3.new(10,10,10);
- tBlock.CFrame = outside
- debris:AddItem(tBlock,.5);]]
- local ray = NewRay(raypos, raydir);
- local hit,pos = workspace:FindPartOnRayWithIgnoreList(ray, characterFile:GetChildren());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement