Hello developers, I am making a script which makes a player infectious to others, and when the player touches another player it gives them the ability to infect another, and so on. Since this is the first time doing so, I decided to attach an infecting part to the player. But if you have better ways, please tell me. So when I did so, the infecting part just stayed in the same position, and didn’t seem to attach to the player.
local part = script.Parent --the infection part
script.Parent.Touched:Connect(function(part)
part.BrickColor = BrickColor.new('Bright green')
part.Parent.UpperTorso.BrickColor = BrickColor.new('Dark orange')
part.Parent.Shirt.ShirtTemplate = 'http://www.roblox.com/asset/?id=1488865898'
part.Parent.Pants:Destroy()
script.Parent.Owch:Play()
part.Parent.Humanoid.WalkSpeed = 10
part.Parent.Head.face.Texture = 'http://www.roblox.com/asset/?id=133360891'
wait(.3)
for _, acc in pairs(part.Parent:GetChildren()) do --destroying accessories
if acc:IsA('Accessory') then
acc:Destroy()
end
end
local infectionPt = part:Clone() --Cloning the infection part
infectionPt.Transparency = 1
infectionPt.Parent = part.Parent --Setting the infection part parent to the Character
I’ve tried attachments, but I have no understanding of how to use them.
Any help/advice would be appreciated, thanks.