#2 problems actually, a bow system and a game handler
1 messages · Page 1 of 1 (latest)
problem 1:
local Debris = game:GetService("Debris")
local event = ReplicatedStorage:WaitForChild("BowFireEvent")
local arrowTemplate = ReplicatedStorage:WaitForChild("Arrow")
event.OnServerEvent:Connect(function(player, targetPosition, power)
local character = player.Character
if not character then return end
local tool = character:FindFirstChildOfClass("Tool")
if not tool then return end
local handle = tool:FindFirstChild("Handle")
if not handle then return end
local arrow = arrowTemplate:Clone()
arrow.Parent = workspace
local primary = arrow.PrimaryPart
if not primary then
warn("Arrow needs PrimaryPart")
return
end
arrow:PivotTo(handle.CFrame)
local direction = (targetPosition - primary.Position).Unit
primary:ApplyImpulse(direction * power * primary.AssemblyMass)
Debris:AddItem(arrow, 10)
end)```
this works but the arrow stays still after it appears for a few seconds and only then begins to fly. I have no idea why there is no waiting cooldown anywhere
secondly,
code too big so its in a txt file, its supposed to be my main game handler script and only the GUI part off it works, i havent touched code in 2 months so i cant fix it myself, please help i just wanna fix these 2 problems so i could continue progressing my game but i just cant fix this even with AI help
the arrow script is connected to local script off bow
if u couldnt tell
anyone? 😔
** You are now Level 4! **
dont expect too much
you still need to figure out the problem yourself, i dont think anyone is gonna help atp idk
i came here because i dont know the problem
yeah but you still need to do the effort of fixing it yourself
so you have double chances of finding the bug
but dont rely too much on people fixing your issue
because the one who knows your code, your writing style, is yourself
and the second reason is because most people have time for themselves lmao
Have been for 2 days
I genuelly can't fix this
I need a star man to help me
arrow does not begin moving immediately: try parenting the arrow to workspace last, after calling the applyimpulse, as this is almost certainly just a matter of physics replication lag -> the instance is created on the server, and then [physics replication delay] later the client receives the physics data causing it to move. usually best practice is to set parent last so that may help here. not a guarantee tho.
'main game handler script IT nO wOrKy!': okay? not sure what advice you expect anyone to give you on that one. you "havent touched code in 2 months so cant fix it" is just an extremely lazy excuse. You absolutely could fix it yourself, you just choose not to because you're being lazy, and I know this because checking this code, this is extremely basic code that you could easily debug in a matter of minutes, only problem is instead of learning how to debug code you're expecting someone else to come in and magically know what "working" is supposed to mean for this script, and magically repair it to match your intentions, which you have failed to express. We're not mind readers here. no one knows what you mean when you say "IT NO WORKY". Don't be so lazy. If you have a problem, explain it. No one is going to do that work for you because no one knows what exactly you are trying to do nor what is wrong with it. After all, the only difference between "IT NO WORKY" and "Working as intended" is, by definition, your intentions, and no one knows what you're intending because you haven't said what the problem is other than "IT NO WORKY".
my advice, google any errors you get in the output window, or even ask ai for that matter https://create.roblox.com/docs/studio/output. but under no circumstances should you be using "Even AI couldn't help!!" as some kind of benchmark for what is and is not possible. no shit the ai couldn't help, AI is not magic. It is not a benchmark for anything, it is also not a mindreader either, and is only as good as you are. That's just like saying "Even you were too lazy to put in any effort to try to fix your own code!", and it would be just as correct.
2 days of asking claude to "plz fix" is not 2 days of genuine effort trying to fix this yourself. this is 2 days of being lazy. put in the work, or don't code. it's that simple https://create.roblox.com/docs/studio/output
i know this may seem a bit harsh but genuinely i think this is what you need to hear. no one can telepathically magic their coding knowledge into your brain, and you are not going to somehow magically learn by just watching the ai spit out code. that's like watching football on tv and expecting it to make you a professional football player. it's just not going to happen. the only way this is going to work is if you take the time to learn how to code properly. I suggest you start back at the start again instead of diving into the deep end with ai drowning you in things you don't understand: https://create.roblox.com/docs/tutorials/curriculums/core
https://create.roblox.com/docs/tutorials/fundamentals/coding-1/coding-fundamentals
i see
I appreciate your help on the bow
i will take your advice and solve the game handler on my own as you really did open my eyes, this'll help me improve myself heavily
idk it doesnt let me check solved so i'll leave it at that
naw it aint work i still need help
the arrow is a much better defined problem, and a common one in roblox so, i'd suggest try setting assemblylinearvelocity instead of applyimpuse. i suspect that won't work either, so if it doesn't, the next one would be to set it up so the client makes the project invisible until it starts moving which you probably need to do in a while task.wait() do if velocity~=0 then break end end loop
it's not pretty but it's easier than getting into a lag compensation system
alr I'll try