Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

best way to create projectiles/ large moving parts?

Asked by 4 years ago

Currently, I’m working on a magic based PvP game, which involves a lot of size changing, moving parts. With FE being enabled, I can’t just create parts via local script like you used to do, so i have a setup like this;

— serverscript —
function magicevent(player)
    parts created, properties assigned, velocities added, etc
end

RemoteEvent.OnServerEvent:Connect(magicevent)

— localscript —
button.Pressed:Connect(function()
    RemoteEvent:FireServer()
end

Sorry for the very vague code, I’m on mobile and tried to give an outline of what I’ve done. I basically have all the creation of parts on the server and have the server handle it once the client calls for it.

This causes a lot of lag, and I was wondering how to do this and avoid the lag caused? I’ve seen multiple games handle a number of moving parts with barely any lag but i’m not sure how.

The only other way I can think of is having everything handled on the client, passing through the server, and replicate it to all other clients using FireAllClients().

2 answers

Log in to vote
0
Answered by
Erie20 102
4 years ago

I don't really know how to move the projectiles, maybe TweeService or VectorMovers? Idk because I never used them.

As for the lag, you can fire the server the remote event, as well as creating a local projectile on the client and moving it as well. The server will handle the detection of the part hitting. This works well and doesnt usually break, chances of client and server conflicting about whether hit or not are 1 in 5000 iI think.

you can check this out for more info on the lag issue

0
what do you mean by fire the server the remote event? also, wouldn’t that end up creating the part twice? EvilMessor 9 — 4y
0
i mean that you do RemoteEvent:FireServer () and have it recive on the server side to create the part while also making a local part. I dont think there will be two parts, if there is i guess you could change the local projectiles name to something and delete the server projectile. idk ive never tried this out. Erie20 102 — 4y
0
https://developer.roblox.com/en-us/articles/Fighting-Against-Lag you can check that out as well as the game in the article. Good luck! Erie20 102 — 4y
0
Alright, thanks! EvilMessor 9 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

If you are moving and object from one place to another you should use object tweening but since you specify it as a projectile then you should use network ownership.

Answer this question