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

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

Asked by
kag_e 12
5 years ago
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

0
CFrame The_Pr0fessor 595 — 5y
0
Terrible at CFrame, any examples of how I would move the bases apart from each other with CFrame? kag_e 12 — 5y
0
if u know how to do "for" loops u could try "for i = 0, 5" and multiplying each bases CFrame by the x The_Pr0fessor 595 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

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.

Ad

Answer this question