That line isn’t the problem. That’s just because I’m tweening the model. This line tells the tween where to tween the model too
local CF = CFrame.new(closestPlayer.Character.HumanoidRootPart.Position)
That line isn’t the problem. That’s just because I’m tweening the model. This line tells the tween where to tween the model too
local CF = CFrame.new(closestPlayer.Character.HumanoidRootPart.Position)
Maybe change it to?
local CF = CFrame.new(closestPlayer.Character.HumanoidRootPart.Position,model.PrimaryPart.CFrame)
Why exactly do you need to use CFrames in this case anyways?
I tried it and it’s not tweening at all now
That’s odd, but again, if I may ask, why do you need to use CFrame? CFrames typically hold a Position and a Rotation again, if you’re doing that to move the model, can’t you just do this?
CFrameValue:GetPropertyChangedSignal("Value"):Connect(function()
local cframe = CFrameValue.Value
model:MoveTo(cframe.p)
end)
So it moves the model with the Position of the CFrame only?
This kind of works but I get this up and down motion with the tween
EDIT: After some reading I found this for the :MoveTo function
If there are any obstructions where the model is to be moved to, such as
Terrain
or otherBasePart
s, then the model will be moved up in the Y direction until there is nothing in the way. If this behavior is not desired,Model:SetPrimaryPartCFrame
should be used instead.
Wait, can’t you just tween the model itself? You can weld the stuff together and just tween the primary part.
Here’s a guide to tweening a model to help you do it simpler
I’ve tried that but only the primary part moves. The rest of the model doesn’t move
I think you may’ve messed up a step. Maybe you could union the part so it’s a single thing and just tween that?
I haven’t, I have unanchored all the parts except for the root part and I have welded them together. Also I can’t make a union as they are mesh parts
Hmm…How much did it rotate? Was it a noticeable rotation?
This is what happens. The primary part moves but the other one doesn’t
No no when you were still using the very first script you showed in your post, how noticeable was the rotation?
It depends on the position the other player stands in but it is pretty noticeable
Okay wait I think I know what it coudl be, keep the Event to this
CFrameValue:GetPropertyChangedSignal("Value"):Connect(function()
model:SetPrimaryPartCFrame(CFrameValue.Value)
end)
But change here
local CF = CFrame.new(closestPlayer.Character.HumanoidRootPart.Position)
To this?
local pos = closestPlayer.Character.HumanoidRootPart.Position
local CF = CFrame.lookAt(pos,pos)
So it sets the CFrame to where the rootpart is and makes it look at the rootpart?
I’ve tried that but it doesn’t work. For some reason it sets the position to (0, -1000000, 0)
I think I’ve figured something out. I just took the CFrame and flipped it by 180 degrees. This is what the line looks like
local CF = CFrame.new(closestPlayer.Character.HumanoidRootPart.Position, player.Character.HumanoidRootPart.Position) * CFrame.Angles(0, math.rad(180), 0)
That would maybe work since it’s setting the position and the lookAt to the closest player and then flipping it, try it out and see how it goes?
First off, remove that. You are ruining the purpose of a tween.
Second,
Let’s fix this.
local pos = closestPlayer.Character.HumanoidRootPart.Position
local pos2 = mainplayerhere.Character.HumanoidRootPart.Position
local CF = CFrame.lookAt(pos2,pos) -- Pos2 being the "from", pos being the "to".
This would create a thing where it would be pointing at the player while it is going towards them, and then when getting close it would turn sideways or like “flat”.
You could have just made it so the mouse can be going to the player from like 3 - 7 studs away, and when the mouse makes contact it makes a effect that it’s disappearing, and the player would die in-game too.
I don’t think he can really remove it since his tween tweens the CFrameValue, meaning this is what he can really do to Tween his model. He could maybe try out your 2nd suggestion but the 1st suggestion doesn’t seem likely with his set up
That’s why he is complaining about why his model is moving up and down though.