Part isn't moving

Very similar to a recent bug I had, but this is still not working (the previous has been corrected)
Can you please just check this game FlappyBird.rbxl (85.3 KB) and see if you find any issue? Thank you.


This is the part that should be moving towards the left (camera view)
Here is the Tweening Script for quicker reference:

local TweenService = game:GetService("TweenService")
local pipePrimaryPart = script.Parent.PrimaryPart
local endCFrame = script.Parent:FindFirstChild("EndCFrame")

local tweenInfo = TweenInfo.new(10, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
local goal = {CFrame = endCFrame.CFrame}
local glide = TweenService:Create(pipePrimaryPart, tweenInfo, goal)

local function work()
	glide:Play()
end

local repStorage = game:GetService("ReplicatedStorage")
repStorage.Events.Start.OnServerEvent:Connect(work)
5 Likes

Does the console have any errors?

3 Likes

Nope, nothing. No errors!

3 Likes

For me it threw an error because the parts hadn’t loaded in.
Try:

local pipePrimaryPart = script.Parent:WaitForChild("PrimaryPart")
local endCFrame = script.Parent:WaitForChild("EndCFrame")
2 Likes

Literally the same thing

4 Likes

That’s strange. It worked fine when I tried it.

Could you send the code that fires Start?

4 Likes
local replicated = game:GetService("ReplicatedStorage")
local function onActivated()
	replicated.Events.Start:FireServer(true)
	script.Parent.Parent.Visible = false
end

script.Parent.Activated:Connect(onActivated)
2 Likes

What is the parent? This might have to be in a Script instead of a LocalScript.

2 Likes

Alright so I looked at the place file, and cleaned it up a bit. Then I found the solution, tweenservice is in fact moving the part, but it is sooo heavy, it can’t be moved. So, once I anchored it, it started to move. Well, only its primarypart was moving, because that’s how tweenservice worked, but it was moving!

So I unioned it and now it moves!

2 Likes

This scripts parent is a TextButton, whose parent is a Frame, whose parent is a ScreenGui, whose parent is StarterGui

LocalScript < TextButton < Frame < ScreenGui < StarterGui

So what does that mean @scavengingbot? How do I union it? I thought I had already done that

2 Likes

Model > Solid Modeling on the top bar

1 Like

You welded it, not unioned. Go to solid modeling > Union.
Also I fixed up a couple of other issues, here’s my version:
FlappyBird.rbxl (84.9 KB)

I wrote the code fast, because I don’t actually care much about the game, but I like wasting time.
You can change whatever you want of course.

Here’s a video:

I don’t know if those parts are supposed to kill you, but I made it so they do since that seemed like the obvious choice.

Hope this helps!

1 Like

Your game thing kinda breaks my mind. Since I won’t already jump to other game aspects such as score, can you just tell me how to make the union go towards EndCFrame below the player? It makes me confuse because I want to make it go straight (no things going more up nor more down), but I no longer have a PrimaryPart at the same x and z (that way, only y changes)

2 Likes

ok sorry, I was wasting my time.

In your project you can fix the issue by unioning the model.
I redownloaded your project and didn’t change anything except the issue, here’s the file:
FlappyBird (2).rbxl (93.4 KB)

Changes


The model is now an anchored UnionOperation.
In the script, the primarypart is now just equal to the scripts parent.
The endcframe points to workspace’s endcframe.

Hope this helps!

2 Likes

That’s very nice, but there still is a small problem: The models are gonna have different sizes, therefore different centers, resulting on it not always moving straight. I should only move in the y direction (left-right)

1 Like

That’s the x direction.
Y is up-down, z is forward-backward.

Anyway, You can always set the Y position before playing the tween:

local function work()
    pipePrimaryPart.Position = Vector3.new(pipePrimaryPart.Position.X, endCFrame.Position.Y, pipePrimaryPart.Position.Z)
    glide:Play()
end

Now it first aligns the part with the end cframe and then moves it, so it is now guaranteed to move only on the X axis.

1 Like

Um sorry I might have mistaken something on my mind about the directions. I thought y being up only applied in 2D.
I’ll take a look on that, then inform you what happened.

1 Like

I don’t know if I copy pasted it wrongly, but it seems to have no difference. I understand the meaning of your code and I think it should work, but it somehow did nothing??

local TweenService = game:GetService("TweenService")
local pipePrimaryPart = script.Parent
local endCFrame = workspace.EndCFrame

if pipePrimaryPart then
	if endCFrame then
		local tweenInfo = TweenInfo.new(10, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
		local goal = {CFrame = endCFrame.CFrame}
		local glide = TweenService:Create(pipePrimaryPart, tweenInfo, goal)
		
		local function work()
			pipePrimaryPart.Position = Vector3.new(pipePrimaryPart.Position.X, endCFrame.Position.Y, pipePrimaryPart.Position.Z)
			glide:Play()
		end
		
		local repStorage = game:GetService("ReplicatedStorage")
		repStorage.Events.Start.OnServerEvent:Connect(work)
	else
		warn("no endCFrame")
	end
else
	warn("no primary part")
end
1 Like

Can you try tweening only the position, instead of the entire CFrame?

local goal = {Position = endCFrame.Position}
1 Like

Nope, it gives the same result