Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Touched problem? What if it is touching already? also networkowner

In this fighting game i made a sort of a bomb, i shoot it and then it expands when touching something. I actually have 2 quesitons about this:

  1. If the other player doesnt move, then the touched event doest happen so he doesnt get damaged. How should i fix this?

  2. I noticed in testing mode (local sever) the bombs expand in different cframes, to one player it explodes later and to other sooner, making their cframes different, which is weird bec of hitboxes and stuff.. Every bomb has the networkowner setted. How should i fix this?

1 answer

For problem #1 you can loop through all the players and attempt to find the distance between the centre of the bomb and the player's HumanoidRootPart (I say "attempt" because they might not have a HumanoidRootPart and maybe not even a Character); something like local dist = (humanoidRootPart.Position - bombCentre).magnitude

Things that affect multiple players should probably be managed by the server, not by any one player (potentially even if one player owns and is controlling the bomb in some way). An advantage to using the server is that the event definitely takes place in one spot, and all the clients will be notified of it automatically by Roblox (rather than the clients all simulating different spots and everyone being out-of-sync, as you have described). If you mean that you already set the NetworkOwner to the server but the bombs are going off at different times (but the same people are affected in every instance), this might just be the Network Simulation feature of Roblox (if you have it enabled); it is unavoidable that people will experience an event at different real times.

This discussion is preserved as it was. New answers, comments, and votes are closed.