So I’m trying to make a spawn point with a script without using parts or spawn models.
This is where I’m at:
–Locals–
local player = game:GetService(‘Players’)
–Spawn–
player.CharacterAdded:Connect(function(character)
character:GetPropertyChangedSignal(“496.5, 26, -378.2”):Wait()
– set position
end)
local Players = game:GetService('Players')
local Spawn = nil
Players.PlayerAdded:Connect(function(NP)
NP.CharacterAdded:Connect(function(c)
c:MoveTo(Spawn.Position)
end)
end
That would actually be a fair reason, although I think it may be the thing that the RootPart must be moved using CFrame instead of Position, but your reasons may be plausible.
Taking into account what you have said, the code should be this
--Locals
local SpawnPosition = CFrame.new(496.5, 26, -378.2)
local Players = game:GetService("Players")
--Spawn
Players.PlayerAdded:Connect(function(Player)
local function moveCharacter(character)
game:GetService("RunService").Heartbeat:Wait()
character:WaitForChild("HumanoidRootPart").CFrame = SpawnPosition
end
moveCharacter(Player.Character or Player.CharacterAdded:Wait())
Player.CharacterAdded:Connect(moveCharacter)
end)
This accounts for the things you have mentioned, it’ll wait a Heartbeat frame before changing the location, and just as a safety measure incase the character is added before the event was set up, a function should prevent that as well. Or I think a better way would be this
--Locals
local SpawnPosition = CFrame.new(496.5, 26, -378.2)
local Players = game:GetService("Players")
--Functions
local function moveCharacter(character)
game:GetService("RunService").Heartbeat:Wait()
character:WaitForChild("HumanoidRootPart").CFrame = SpawnPosition
end
--Spawn
Players.PlayerAdded:Connect(function(Player)
moveCharacter(Player.Character or Player.CharacterAdded:Wait())
Player.CharacterAdded:Connect(moveCharacter)
end)
So it doesn’t have to make the function again each time a player joins, but I think the former should still work fine as well