CFrame in script isn't the same as cframe in workspace

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I Want to make the pokemon tween to the same cframe as the pokeball

  2. What is the issue? Include screenshots / videos if possible!
    The pokemon tweens to a random cframe close to the pokeball’s cframe

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I searched every possible post with a similar problem and found nothing.
    image
    The square is supposed to be the “Pokeball Cframe” according to the module script, i made it so it creates a part with the same cframe as the pokeball to show the problem better.

Here is the module script

local TS = game:GetService("TweenService")

-- The target is the pokemon btw

local module = {}

function module.CatchAnimPlay(Target:MeshPart, Pokeball:Part)
	
	Target.Anchored = true
	Target.TextureID = ""
	Target.Material = Enum.Material.Neon
	Target.Transparency = 1
	
	local a1 = Instance.new("Attachment", Target)
	local a2 = Instance.new("Attachment", Pokeball)
	
	task.delay(.3,function()
		Pokeball.AssemblyLinearVelocity = Vector3.zero
		Pokeball.AssemblyAngularVelocity = Vector3.zero
		Pokeball.Anchored = true
		Pokeball:WaitForChild("Beamforpoke").Attachment0 = a1
		Pokeball:WaitForChild("Beamforpoke").Attachment1 = a2
	end)
	
	local TS1 = TS:Create(Target, TweenInfo.new(1.5), {Size = Vector3.new(5,5,5), Transparency = 0}) :: Tween
	TS1:Play()
	
	TS1.Completed:Connect(function()
		
		local newCframe = game.Workspace:WaitForChild(Pokeball.Name).CFrame
		
		local part = Instance.new("Part", workspace)
		part.Anchored = true
		part.Size = Vector3.new(5,5,5)
		part.CFrame = Pokeball.CFrame
		
		local TS2 = TS:Create(Target, TweenInfo.new(1), {CFrame = Pokeball.CFrame, Size = Vector3.new(0.1,0.1,0.1)}):Play() :: Tween
	end)
	
end

return module
1 Like

Your not playing the TS2 tween, and you have 2 properties in the TS2 Tween, try separating them and playing them at the same time.

EDIT:You are playing them sorry

I got rid of the size property and still didn’t work so I don’t think having two properties is the issue ty tho

The solution was changing the module script to a local script that was fired in all clients. I don’t really know why but i think the cframe changed or had an offset because of lag in the server or smth.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.