Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

?Make a new player a base with the players name assigned?

local base = game:GetService("ReplicatedStorage").p:Clone()

local bases = workspace:WaitForChild("playerbases"):GetChildren()

base.Name = game.Players.LocalPlayer.Name
base.Parent = workspace:WaitForChild("playerbases")

game.Players.PlayerRemoving:Connect(function(player)
	base:Destroy()
end)

Above code works just to make the base and insert it in the game, but I want the bases to never be touching each other.

So basically

Bases (NOT TOUCHING EACH OTHER SEPARATED) Bases names are the players names

3 comments

0

CFrame

0

Terrible at CFrame, any examples of how I would move the bases apart from each other with CFrame?

0

if u know how to do "for" loops u could try "for i = 0, 5" and multiplying each bases CFrame by the x

1 answer

What I would do in this situation is give the base model a primarypart, and use get/setprimarypart CFrame to set a CFrame.

Example:

base = game.ReplicatedStorage.p

--100 as an example
lengthOfBaseInStudsX = 100

--The amount of space in between each base
offset = 30

oldBase = game.Workspace.LastPlayerJoinedBaseHere

base:SetPrimaryPartCFrame(oldBase:GetPrimaryPartCFrame() * CFrame.new(lengthOfBaseInStudsX + offset, 0, 0) )

I used a modified version of this for a infinite runner game and it worked quite well.

This discussion is preserved as it was. New answers, comments, and votes are closed.