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

[SOLVED] How do I make PlayerRemoving local?

Okay so, I'm trying to make a claiming door, but I need it to be so that when the player THAT OWNS the door gets their room wiped so that someone else can claim it. But I don't know how to make this local because whenever someone leaves it makes all of the rooms available. Even though I want it to be for that player only who left.

Here's my code:

local Click = script.Parent.ClickDetector

local default = ""
local defaultAv = "Available Room"

local ImageLabel = script.Parent.Parent.Gold3.SurfaceGui.ImageLabel

local text2 = script.Parent.Parent.Gold.SurfaceGui.TextLabel

local UserValue1 = script.Parent.Parent.WhoID
local UserValue2 = script.Parent.Parent.WhoUser

Click.MouseClick:Connect(function(playerWhoClicked)
	UserValue2.Value = playerWhoClicked.Name
	Click.MaxActivationDistance = 0
	UserValue1.Value = playerWhoClicked.UserId
	text2.Text = playerWhoClicked.Name.."'s Room"
end)

game.Players.PlayerRemoving:Connect(function()
	ImageLabel.Image = "rbxasset://textures/ui/GuiImagePlaceholder.png"
	UserValue1.Value = default
	UserValue2.Value = default
	text2.Text = defaultAv
	Click.MaxActivationDistance = 10
end)

Basically, tell me how to make the "game.Players.PlayerRemoving" local.

Thanks!

1 comment

0

Also, this is a script in the Workspace.

2 answers

✓ Accepted answer

I'm currently busy scripting something but I'll try to help you when I'm done!

3 comments

0

I'm going to add you

0

I'm going to add you

0

It's alright, I figured out how to make it local

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