Right now, this script only runs when the player enters, then never runs again. I want to make it run again when the player respawns, but I'm not sure how I would go to doing this.
local wings = game.ReplicatedStorage.Wings local mps = game:GetService("MarketplaceService") game:GetService("Players").PlayerAdded:Connect(function(player) if mps:UserOwnsGamePassAsync(player.UserId,5260848) then local function createMachine() local wingsClone = wings:Clone() wingsClone.PrimaryPart = wingsClone.Base wingsClone.Parent = player.Character wingsClone:moveTo(player.Character.Torso.Position) local weld = Instance.new("Motor6D") weld.Parent = wingsClone.Base weld.Part0 = wingsClone.Base weld.Part1 = player.Character.Torso end createMachine(player) end end)
Use the CharacterAdded
Event.
local wings = game.ReplicatedStorage.Wings local mps = game:GetService("MarketplaceService") game:GetService("Players").PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function() if mps:UserOwnsGamePassAsync(player.UserId,5260848) then local function createMachine() local wingsClone = wings:Clone() wingsClone.PrimaryPart = wingsClone.Base wingsClone.Parent = player.Character wingsClone:moveTo(player.Character.Torso.Position) local weld = Instance.new("Motor6D") weld.Parent = wingsClone.Base weld.Part0 = wingsClone.Base weld.Part1 = player.Character.Torso end createMachine(player) end end) end)