This Game event does not work AT ALL in-game but works in roblox studio

Normal Script:

game.Players.PlayerRemoving:Connect(Remove)

^^^^^^^Snippet

-The Name variable carrys the name and Device1.Person is a textbox, (The name is also a string) -The event checks if the player has left

-What i am looking for is, The Event is not working but only in roblox studio it works, and the rest of the code already works

function remove()
--Name variable
 name = game:FindFirstChild("ReplicatedStorage").SurfaceGui.Device1.Person.Text
	if workspace:FindFirstChild(name) == nil then
		workspace:FindFirstChild("Device1").Billbourd.BillboardGui.TextBox.Text = ""
		game:FindFirstChild("ReplicatedStorage").SurfaceGui.Device1.Text = "off"
		game:FindFirstChild("ReplicatedStorage").SurfaceGui.Device1.Person.Text = ""
	end
end
--event
game.Players.PlayerRemoving:Connect(remove)

3 comments

0

Don't repost every hour

0

sorry

0

Im just getting desperate.