They still just sit off the head and fall off
Alright, try now? I edited the drop script to parent the drop model to the workspace.Drops folder first. Have a hunchâŚ
LEGEND! Thank you sosoosososososo much!!!
This has been a painful experience lol. Glad to get it over with
Thank you so much!
Wait. Now i cant collect coins
AHHHHHHHHHHHHHHHHHHHHHHH IM NOT EVEN RELIGIOUS BUT I BET THIS IS GODS DOINGGG
Finally lol! Glad I could help! Iâm glad thatâs over. I know what itâs like to not find any help. Actually I never really post on the DevForum (too much work), but maybe I will now. Very time consuming though not gonna lie. Well, great! Hope your game goes well. Happy (albeit frustrating) scripting!
Wait what- NOOOOOO
It was it this moment he knew. He messed up.
I Think i know why. The coins are parts. so you have done something to make it a model. ill try fix it aswell
Alright, here we go again . One more question. When you say it wonât collect, do you mean the coins arenât reacting to the player (they arenât flying toward them) or they do fly toward them, but the playerâs currency doesnât go up? Depending on this I might have a solution
Wait, the coins are collecting. just extremely late
there collecting now?
I only start collecting them after 15 seconds from when they spawn. then i can collect them like before
Nevermind, now its working lol. Guess i fixed it. Thanks for the help
Alright, I think I know. To simplify things, I used the pivot of the model rather than the coins themselves to detect if the player was close enough. However, the modelâs pivot is relative to the originCFrame
, so itâll only collect when you get close to where the coins started from, not the coins themselves. I thought itâd be simpler than iterating over each coin to see if one were close enough, but it seems thatâs how it should be. Iâll edit it one last time, then hope and pray itâs over - oh you already fixed it XD Well regardless Iâll edit my solution to check each coinâs position instead of the modelâs pivot. Sorry for any trouble youâve had lol, it sure is a great test of patience.
Heh, only took 72 posts to solve your problem haha
Edited it one last time. Phew
Yeah lol, if i have any major issues in the future. ill come to you (as long as it doesnât take 4 hours are 72 posts to resolve. At that point ill just give up)
Thanks again. I can now live relaxed- THEYâRE BROKEN AGAIN!
jk. Again, thanks for the help! Have a good rest of your day
I know the problem was already solved, but you couldâve just added a task.delay.
Code:
local player = game.Players.LocalPlayer
local Character = player.Character or player.CharacterAdded:Wait()
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
local ts = game:GetService("TweenService")
local rs = game:GetService("ReplicatedStorage")
while task.wait() do
for i, drop in pairs(workspace.Drops:GetChildren()) do
if drop:IsA("Part") and not drop:GetAttribute("Collected") and drop:FindFirstChild("Value") then
local magnitude = (HumanoidRootPart.Position - drop.Position).Magnitude
if magnitude <= player.Data.MagnetReach.Value then
drop:SetAttribute("Collected", true)
task.delay(2, function()
local value = drop:WaitForChild("Value").Value
local CurrencyName = drop:WaitForChild("CurrencyName").Value
drop.CanCollide = false
local tween = ts:Create(drop, TweenInfo.new(magnitude * 0.01, Enum.EasingStyle.Sine), {Position = HumanoidRootPart.Position})
tween:Play()
tween.Completed:Wait()
rs:WaitForChild("GiveCurrency"):FireServer(CurrencyName, value)
drop:Destroy()
rs:WaitForChild("Sounds").Collect:Play()
end)
end
end
end
end
But wouldnât this only collect 1 coin every 2 seconds
No, task.delay runs the section in a new âthreadâ so the wait doesnât impact anything else.
- 72 REPLIES ON THIS POST. AND I COULD HAVE DONE THAT?
dang, i feel bad for everyone ngl lol.
Thanks anyways
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.