I’m new to the DevForum, so sorry if I make any mistakes.
What do you want to achieve? I want to create a system where if a developer joins the game, the StarterCharacter is disabled for them.
What is the issue? I just began scripting not long ago, so I don’t know how to make a system like this.
What solutions have you tried so far? No solutions so far, I’m looking for help on how to create it.
Here is my script so far, as I’ve stated, I’m seeking scripting help so there isn’t much.
game.Players.PlayerAdded:Connect(function(Player)
local StarterCharacter = game.StarterPlayer.StarterCharacter
local PlayerId = 620047192
if Player.UserId == PlayerId then
--I don't know what to do here, I want to disable StarterCharacter if I join the game
end
end)
local HumanoiDescription; -- Path to HumanoidDescription
local PlayerId = 620047192
local function CharacterAdded(Character)
Character.DescendantAdded:Connect(function(inst)
if inst:IsA("Humanoid") then
inst:ApplyDescription(HumanoidDescription)
end
end)
end
game.Players.PlayerAdded:Connect(function(Player)
if not Player.UserId == PlayerId then
if Player.Character then
CharacterAdded(Player.Character)
end
Player.CharacterAdded:Connect(CharacterAdded)
end
end)
If i remenber correctly, u have to put a character called “Starter Character” in StarterPlayer, so just disable character AutoLoads and then just Load the StarterCharacter if the player isn’t a dev with plr:LoadCharacter() or else if the player is a dev just copy the starterCharacter, remove the old one, set the clone parent to ReplicatedStorage And then Load the Dev’s Character so it will load his Character instead of the default one and then copy again the cloned char and put it back in StarterPlayer but you will also have to Load The player’s character when they died because we disabled the character Auto Loads. There is Probably a Better way of doing that because i think there will be some problems with this method if for example 2 Players join at the same time, Hope it helped you !
local function add(chr)
if game.Players:GetPlayerFromCharacter(chr) then
if game.Players:GetPlayerFromCharacter(chr).UserId == 620047192 then
chr.Head.Anchored = true
chr.HumanoidRootPart.Anchored = true
chr:WaitForChild("Shirt")
chr:FindFirstChildOfClass("Shirt").ShirtTemplate = "http://www.roblox.com/asset/?id=8012290488"
chr:WaitForChild("Pants")
chr:FindFirstChildOfClass("Pants").PantsTemplate = "http://www.roblox.com/asset/?id=8012294238"
--[[ Optional, for Hat in SS:
local hat = game:GetService("ServerStorage").hat:Clone()
hat.Parent = chr
hat.Position = chr.Head.HatAttachment.WorldPosition
hat.Orientation = chr.Head.HatAttachment.Orientation
]]--
chr.Head.Anchored = false
chr.HumanoidRootPart.Anchored = false
end
end
end
game.Workspace.ChildAdded:Connect(add)