The title of this topic already describes what i am trying to do.
Here’s the code:
--local mod = require(game.ReplicatedStorage.tweenMod)
local catched = {}
local allPoses = {}
for i,v in pairs(script.Parent.Parent.Parent.Poses:GetChildren()) do
table.insert(allPoses, v)
print(allPoses)
end
script.Parent.Touched:Connect(function(hit)
local hum = hit.Parent:FindFirstChild("Humanoid")
for i,v in pairs(catched) do
if hum and v ~= hit.Parent.Name then
local character = hit.Parent.HumanoidRootPart
table.insert(catched,hit.Parent.Name)
print(catched)
hum.WalkSpeed = 0
hum.JumpPower = 0
local characterAttach = Instance.new("Attachment")
characterAttach.Name = "Attachment0"
characterAttach.Parent = character
local AlignPosition = Instance.new("AlignPosition")
AlignPosition.Attachment0 = character.Attachment0
AlignPosition.Attachment1 = allPoses[math.random(1,#allPoses)].Attachment1
AlignPosition.Responsiveness = 100
AlignPosition.Parent = character
else
return
end
end
end)
To make it simple and short i want to make a player float to random poses (which you can see in the for loop) using alignPosition but it doesn’t even parent it to the HumanoidRootPart.
character.HumanoidRootpart because you parented the Attachment to the HumanoidRootPart FindFirstChild only does a shallow check or it only gets the children does not get descendants
also avoid using Touched part
Oh my bad then the problem probably lies with the fact u are using Touched Event which is not good i think it would be better to GetPartBoundsInBox And Also use a debounce so its not called multiple times.
Yeah i was thinking about that because when i used touched event it didnt even print catched table.
i already made a table for that which checks if the user is in the “catched” table if he is not then it inserts the character name into the table or else it wont check multiple times