Why my script is not working?

ok so I have this script so the player can pick up logs but for some reason the logs does not move to the players position

2 Likes

Any errors in console? If so, post screenshots. But if not, does the pickupTween play? Have you tried inserting a print inside the if statement to see if it meets the conditions?

there is not errors but let me try adding print and see if it works

it seems that its not playing the tween because the print that i added does not appear

How about changing the if to this:

if (Character.PrimaryPart.Position - log.Position).Magnitude < 10 then

The character’s PrimaryPart should already exist (presumably the Head by roblox default standards) and “log” exists by default since you’re looping through a folder full of them.

Does this fix the problem?

Try this:

local pickupTween = TweenService:Create(log,TweenInfo.new(1),goal)

Oh and also you should do <= instead of <.

I already changed that I thought it was the error too but its not

I just changed it but still no work

let me test that to see if it works

its no working i dont know why

does the log have multiple parts?

Try printing the magnitude itself:

print((Character.PrimaryPart.Position - log.Position).Magnitude)

That may be the problem.

image

no its only 1 mesh all the log

Have you tried using “pairs” instead of “ipairs”? For looping through parts the “pairs” is more reliable.

1 Like

Now it works I changed the ipars to pairs and i also changed the magnitude to a higher number and now i works. thanks for the help

Gotcha we are here for you, anytime bro. :wink: :+1:

1 Like

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