Script with Teleporting not working?

game.Players.PlayerAdded:Connect(function(player)
local green = game.ServerStorage:WaitForChild("SpinGreen")
green.Parent = workspace
green.Position = player.Character.PrimaryPart.Position
end)

I have a script that teleports a part to the player, but it doesn’t work? What is wrong with my script?

should the part teleport only if a player joins or everytime the character gets added?

This should work

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Wait() wait()
	local green = game.ServerStorage:WaitForChild("SpinGreen")
	green.Parent = workspace
	green.Position = player.Character.PrimaryPart.Position
end)

Doesn’t work :frowning: I want it to replace the player and the only way I’ve found how to do this is to teleport it to them. I want it to appear as a magic power for like 5 seconds and disapear.

Maybe try this?

Also, you should have the part in ReplicatedStorage, not ServerStorage. You can use Debris for making the part disappear.

local Debris = game:GetService("Debris")

local spawnedPart = game.ServerStorage:WaitForChild("SpinGreen")

game.Players.PlayerAdded:Connect(function(player)
	local character = player.CharacterAdded:Connect(function(character)
		local spawnPart = spawnedPart:Clone() do
			spawnPart:PivotTo(character:GetPivot())
			spawnPart.Parent = workspace
		end
		
		Debris:AddItem(spawnPart, 5)
	end)
end)

Also, do you want the player visible while the part is there or no?

This spawns in the part, but does not (repeatably) teleport it to the player