Hey guys, I need some help. I'm making a radio gamepass, with a radio which spawns on the back of the player when they have the gamepass Everything works well excluding the welding of the radio onto the player itself. It always goes on the right spot or the wrong spot even without changing the code once and it's broken in general.
Here's the code. Also, there is no errors in the output.
-- If you want R6 instead of R15, replace UpperTorso with Torso.
local marketplaceService = game:GetService("MarketplaceService")
local part = game.ReplicatedStorage:WaitForChild("Radio")
local gamepassID = 10743650
local hasGamepass
-- spawn radio
function onPlayerAdded(client)
local Character = client.Character or client.CharacterAdded:Wait()
if marketplaceService:UserOwnsGamePassAsync(client.UserId, gamepassID) or hasGamepass == true then
local cloned = part:Clone()
cloned.Parent = Character
cloned.Handle.Mesh.Offset = Vector3.new(0,0,-0.5)
else
print("[RADIO] "..client.Name.." does not have the gamepass.")
end
end
-- respawn radio
game:GetService('Players').PlayerAdded:Connect(function(client)
local Character = client.Character or client.CharacterAdded:Wait()
client.CharacterAdded:Connect(function(chr)
Character = chr
Character:WaitForChild("Humanoid").Died:Connect(function()
Character.Radio.Handle.Sound:Stop()
if marketplaceService:UserOwnsGamePassAsync(client.UserId, gamepassID) or hasGamepass == true then
local cloned = part:Clone()
cloned.Parent = Character
cloned.Handle.Mesh.Offset = Vector3.new(0,0,-0.5)
end
end)
end)
end)
local sendClient = game:GetService("ReplicatedStorage").RadioEvents.sendClient
local boughtGamepassFeatures = game:GetService("ReplicatedStorage").RadioEvents.giveFeatures
-- give radio after purchase
sendClient.OnServerEvent:Connect(function(player)
local Character = player.Character or player.CharacterAdded:Wait()
marketplaceService.PromptGamePassPurchaseFinished:Connect(function(gamepassID)
hasGamepass = true
local cloned = part:Clone()
cloned.Parent = Character
cloned.Handle.Mesh.Offset = Vector3.new(0,0,-0.5)
boughtGamepassFeatures:FireClient(player)
end)
end)
game.Players.PlayerAdded:Connect(onPlayerAdded)
Thanks!

2 comments
You haven't set the Part0-1 data or the Weld's Parent. You also shouldn't instantiate an Instance when you haven't affirmed it's use.
@Ziffixture that doesn't work. yes that was an error of mine since i was using welds before but now im using attachments. thanks for the help in that respect though, but it didn't help