I’m trying to make a HotPotato gamemode in a Color Coding game, but I can’t weld a bomb model’s primarypart 2 studs in front of a random player’s root.
function HotPotato:WeldBomb(bomb,root)
local weld = Instance.new("WeldConstraint")
weld.Part0 = bomb.Bomb
weld.Part1 = root
weld.Name = "HotPotatoWeld"
weld.Parent = bomb
return weld
end
The line attempting to weld Part0 fails with the error “Bomb is not a valid member of Player “Players.Violet_sheer”” even though “bomb” is the bomb model.
I’m trying to a weld a part from the inside of a model to a player’s root part. Is that possible?
I checked, its not that sadly. I used print statements to run through the instances and every child and everything seems right but for some reason it isn’t.
Also your code:
weld.Part0 = bomb.Bomb
After reading that, I can make conclusion that bomb = Players.Violet_sheer
First mistake possible is that bomb is PLAYER. Even if I’ll skip this mistake, Player hasn’t any models. Player.Character has them. So use bomb.Character.Bomb instead.
Yeah I realized that I was actually saying bomb = bomber which bomber is a player. I can’t seem to get the model to position properly though because when I use MoveTo or PivotTo, instead of going where I wanted to, it’ll move a colossal amount of studs away.
When I teleport it doesn’t work, when I don’t, it does. If I don’t wrap the loop in a task.spawn function then it’ll run forever which makes the events in the future never happen.
How can I prevent teleporting from messing up my positioning?