hello developers! recently, ive been working on a capture the flag game and i need it so whenever the person who has the flag dies, the flag drops so other people can take it. here is what i have so far:
picking up flag
on death
basically, the model that should teleport to the character’s humanoid root part whenever they die. instead, it only teleports the primary part of the model, which is the pole. here is how i have my welds set up:
here is the code for the flag respawning. this script is in the startercharacterscripts if that matters and it is a server script
local character = script.Parent
local player = game.Players:GetPlayerFromCharacter(character)
local blueflag = game.ReplicatedStorage.Assets.BlueFlagPickup
local redflag = game.ReplicatedStorage.Assets.RedFlagPickup
character.Humanoid.Died:Connect(function()
if player.Stats.HoldingFlag.Value == true then
player.Stats.HoldingFlag.Value = false
if player.Team ~= "Blue" then
local newflag = blueflag:Clone()
newflag.Parent = workspace.FlagPickups
newflag.PrimaryPart.CFrame = character.HumanoidRootPart.CFrame
end
end
end)
if you know the answer to this, i would greatly appreciate it if you would comment and tell me because ive been stuck on this for a while. thank you!