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

My script checks if the player has left how do i fix it, because it only works in Test mode?

Asked by
Nootian 184
4 years ago

I did this: It detects the signal and transfers it from a Local Script to a Script but the Remove event doesn't do anything... and it only works on Studio Test Mode... Can someone help? Local Script:

function Remove()
print(1)
game:FindFirstChild("ReplicatedStorage").RemoteEvent:FireServer("remove",game.Players.LocalPlayer)

end
--\/     Remove Event
game.Players.PlayerRemoving:Connect(Remove)

Using a Remote Event to transfer the signal

Script

function Check("Word")
print(2)
If Word == "Remove" then
    --Removing scripts
end
game:FindFirstChild("ReplicatedStorage").RemoteEvent.OnServerEvent(Check)
0
when i test it with someone else and Purposely leave the game it does nothing. Nootian 184 — 4y

2 answers

Log in to vote
0
Answered by
karlo_tr10 1233 Moderation Voter
4 years ago

No need to send remote to detect if player is leaving or joining. PlayerAdded and PlayerRemoving are events that can run on server. Also remote event has player that sent the event as first parameter and word shouldn't have quotation marks so you would need to have:

function Check(player,word)
0
Thank you!!!!!! Nootian 184 — 4y
Ad
Log in to vote
0
Answered by
Xapelize 2658 Moderation Voter Community Moderator
4 years ago

I think you did a problem that deserve the whole script wasn't work.

The print(1) and print(2) must have quotation marks, you must do print("1") and print("2") instead of print(1) and print(2).

I just think that error occurred the whole script...

Don't wrong this simple problem again, hope I helped and bye! :3

0
Sorry for my grammar XD I was hard to explain because I was a child Xapelize 2658 — 4y

Answer this question