#how would i simulate a bullet in roblox studio

1 messages · Page 1 of 1 (latest)

pure warren
#

hi, i'm looking to make a gun system but i haven't been able to get beyond the bullet part, i dont know how to simulate a bullet

im not asking for anybody to make code for me, i just want to know the basics of creating a bullet and any references

glass reefBOT
#

studio** You are now Level 4! **studio

ebon obsidian
#

this is rudimentary but create a small part in front of the gun, call it barrel, then create the bullet that spawns on the barrel then tween it while calculating the distance from barrel position to mouse target to get an accurate speed on bullet travel

ebon obsidian
wintry charm
#

serverside tweens are really bad for replication

#

the best way would be to simulate the bullet on the server and make the visuals for it on the client

#

with raycasts/spherecasts

pure warren
#

yk how a bullet moves

#

how would i make the visuals match with the bullet

wintry charm
#

start position + velocity * (currenttime - starttime)

#

thats the position

pure warren
#

well idk

muted tulip
#

Get a gun

#

Make a part called "bulletStartPoint" (transparent, anchored, not collidable) which is in front of the barrel where the bullet would leave out of the gun

glass reefBOT
#

studio** You are now Level 6! **studio

muted tulip
#

That's your bullet start point

#

Then you can just make it a thin skinny part that appears and disappears every 0.1s

pearl tree
pearl tree
muted tulip
#

Stop rage baiting

pearl tree
#

ur ed