#Script stops working after respawning

25 messages · Page 1 of 1 (latest)

low solstice
#

I have a script which flings me forward whenever I press F. Here is how the script goes:

  • Press F and it fires an event which runs a server script which Changes a BoolValue inside the character to True
  • Local script which detects whenever the BoolValue is changed and only works when the BoolValue is true
  • If BoolValie is true , it fires a remote event which in turns runs a server script to fling and ragdoll my player

It works fine the first time but does nothing when I respawn

dusk magnet
#

Should work

low solstice
#

@dusk magnet how can i make custom attributes?

ebon flower
ebon flower
low solstice
ebon flower
#

Thats exactly what exploiters can exploit. Client checks. Exploiters can change the value

low solstice
#

i made it work now

ebon flower
low solstice
#

client will press f which fires an event and the server changes the value

#

I fixed the issue but there is another problem lol

#

I made it so that everytime i fling , the direction gets printed

#

after i respawn

#

the amount of print gets incremented

#

everytime i respawn

#

the print gets increases by 1

ebon flower
#

Okay, that might be because of connections.

#

Basicly, if the event doesnt get deleted the function will still run and print it.

#

If you connect a function to the characteradded of the player or something and another function in that function, it will run continously

ebon flower
#

you can store a connection in a variable and then disconnect it

#

for example:

local players = game.Players

local connection = players.PlayerAdded:Connect(function(plr)
  print(plr.Name)
end)

task.wait(10)

connection:Disconnect()