Question about StarterCharacterScripts

So for the past few days while scripting, I noticed that when I try to Clone() an object and parent it to a character using a script in StarterCharacterScripts, the script is unable to parent the object to the character. Is StarterCharacterScripts unable to parent objects to characters, or am i just doing it wrong?

Here is the script I am using, if necessary:

-- This is a tagging script btw, it handles the tagging interaction between players because it is a hot potato-like game

local char = script.Parent
local humanoid = char:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
local player = game.Players:GetPlayerFromCharacter(char)
local taggedValue = player:WaitForChild("Tagged")

local holdAnim = script.HoldAnim
local holdAnimTrack = animator:LoadAnimation(holdAnim)

local debounce = false -- A cooldown between touching players, you don't want them to pass the bomb immediately...

local head = char:WaitForChild("Head")
local torso = char:WaitForChild("Torso")
local leftarm = char:WaitForChild("Left Arm")
local rightarm = char:WaitForChild("Right Arm")
local leftleg = char:WaitForChild("Left Leg")
local rightleg = char:WaitForChild("Right Leg")

local function passBomb(partTouched)
	local enemyChar = partTouched.Parent
	local enemyHumanoid = partTouched.Parent:FindFirstChild("Humanoid")
	if enemyHumanoid ~= humanoid and debounce == false then
		debounce = true -- Cooldown activate
		if taggedValue.Value == true then -- If you're tagged, you get untagged
			taggedValue.Value = false
			bomb = game.ReplicatedStorage.Objects.Bomb:Clone()

			bomb.Parent = char -- This is the code that parents the bomb to the character, for some reason the bomb doesn't appear!

local bombAttachment = bomb.Attachment
			local armAttachment = char["Right Arm"].RightGripAttachment
			local weld ="Weld", bomb)
			weld.Part0 = bomb
			weld.Part1 = char["Right Arm"]
			weld.C0 = bombAttachment.CFrame
			weld.C1 = armAttachment.CFrame
		else							  -- If you're not tagged, you get tagged
			taggedValue.Value = true
			if bomb then
				bomb.Transparency = 1
		wait(1) -- How long cooldown is, or how long the player is immune to the other player's touch
		debounce = false


There may be some inaccurate and illogical things here and there in the script; it is still in progress.

Thanks for reading this post by the way, I know it is pretty long.


The code seems fine, are you shure that the model is visible and collision are turned off ?
Can happen that is spawns but fly away beacause off it.

While playing you can select your player in the workspace and see yourself if it spawned.

Is this not working on both the client and the server, or just the server? Because functions run on the client will not replicate to the server. You may need to add a RemoteEvent and connect it to a script in like ServerScriptService.

The problem goes away when I connect the code to a script in ServerScriptService through an event.

Both local and server scripts don’t work, as long as they are inside startercharacterscripts. I have tried linking it to a serverscriptservice script and it does work, but it does not really answer my question as to why this happens with scripts in startercharacterscripts.

Edit: I figured out the solution to the question, apologies for troubling you. I forgot to run the function when the player is randomly tagged by another script, so it only fires when you touch another player. My statement above is wrong - it works on any server script, and does not work on local scripts at all.

1 Like

No worries, I’m glad you figured it out!