Client Sided Forcefield, how can i stop this

So i made have a local script that connects to a proximity prompt in starter gui, to open the gui and anchor the player, the issue is that when i added forcefield it would be client sided and people would still get killed while in the gui

If i could get some ideas or advice, to make forcefield work, but also not changing the whole script that would be awesome

thanks!

you can use a RemoteEvent for this kind of job, fire the server to anchor/unanchor the player and give/remove forcefield

Remember: Exploiters can fire the remoteevent themselves, so make sure it’s not exploitable, never trust the client

alternatively, make a server script handle all of this.

1 Like

i’ve tried that but it broke the forcefield entirely, maybe im just doing it wrong though? Also how could I organize this?

put the RemoteEvent in ReplicatedStorage and server script in ServerScriptService.

on the line where you put the forcefield, fire the server with some arguments to let it know you want to give it and anchor the player, and a different argument for when you want it removed

1 Like

ooh, thats an idea. i really appreciate it and i love how you explained it well. thank you so much!

1 Like

Also would i use 2 remote events to turn the forcefield off and on if the player closes the ui?

that’s your decision,

personally i’d just use different arguments for them
client:
remote:FireServer(true)
server:

remote.OnServerEvent:Connect(function(player, argument)
if argument==true then
-- give the player the forcefield
else
-- remove the forcefield
end
end)

So what I did was put a forcefield instance and then parent it to the character, how would i put that in?

forcefield.Parent = player.Character

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.