I have an problem with an starterplayer local script

i have an problem with an starterplayer local script

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvent = ReplicatedStorage:WaitForChild("unclaim")

local stores = {
	game.Workspace.STORE,
	game.Workspace.STORE1
}

for _, store in pairs(stores) do
	local claimprox = store.Door.door.door.ProximityPrompt -- Adjust the path to the actual ProximityPrompt
	local unclaimprox = store.Door.door.door.UnclaimPrompt -- Adjust the path to the actual UnclaimPrompt
	local door = store.Door.door.door -- Adjust the path to the actual door object
	local claim = door.claim -- Assuming claim is a Value object within the door
	local name = door.name -- Assuming name is a Value object within the door

	local text = store.Sign.Sign
	local surfaceGui = text.SurfaceGui

	-- Function to handle unclaim logic
	local function handleUnclaim()
		if claim.Value == "true" then
			claimprox.Enabled = true
			claim.Value = "false"
			name.Value = ""
			door.CanCollide = true
			if surfaceGui then
				local textLabel = surfaceGui:FindFirstChild("TextLabel")
				if textLabel then
					textLabel.Text = "UNCLAIMED!"
				end
			end
		end
	end

	RemoteEvent.OnClientEvent:Connect(function()
		unclaimprox.Enabled = true
		handleUnclaim()
	end)
end

for some reason its saying: door is not a valid member of Model “Workspace.STORE.Door.door” - Client - LocalScript:10

You need to add a :WaitForChild()

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvent = ReplicatedStorage:WaitForChild("unclaim")

local stores = {
	game:GetService("Workspace"):WaitForChild("STORE"),
	game:GetService("Workspace"):WaitForChild("STORE1")
}

for _, store in pairs(stores) do
	local claimprox = store.Door.door.door.ProximityPrompt -- Adjust the path to the actual ProximityPrompt
	local unclaimprox = store.Door.door.door.UnclaimPrompt -- Adjust the path to the actual UnclaimPrompt
	local door = store.Door.door.door -- Adjust the path to the actual door object
	local claim = door.claim -- Assuming claim is a Value object within the door
	local name = door.name -- Assuming name is a Value object within the door

	local text = store.Sign.Sign
	local surfaceGui = text.SurfaceGui

	-- Function to handle unclaim logic
	local function handleUnclaim()
		if claim.Value == "true" then
			claimprox.Enabled = true
			claim.Value = "false"
			name.Value = ""
			door.CanCollide = true
			if surfaceGui then
				local textLabel = surfaceGui:FindFirstChild("TextLabel")
				if textLabel then
					textLabel.Text = "UNCLAIMED!"
				end
			end
		end
	end

	RemoteEvent.OnClientEvent:Connect(function()
		unclaimprox.Enabled = true
		handleUnclaim()
	end)
end

lets see…
i love pizza i lova pizza

nope still the same error: door is not a valid member of Model “Workspace.STORE.Door.door” - Client - LocalScript:10

Next time try to reply (on respond button)

Can you show the line that’s causing that?

Script ‘Players.harelnave123.PlayerScripts.LocalScript’, Line 10 - Studio - LocalScript:10

No, ik. But show me the actual line. The source line

thats what you wanted me to send?

1 Like

try this code:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvent = ReplicatedStorage:WaitForChild("unclaim")

local stores = {
	game:GetService("Workspace"):WaitForChild("STORE"),
	game:GetService("Workspace"):WaitForChild("STORE1")
}

for _, store in pairs(stores) do
task.spawn(function()
task.wait(1)
local claimprox = store.Door.door.door.ProximityPrompt -- Adjust the path to the actual ProximityPrompt
	local unclaimprox = store.Door.door.door.UnclaimPrompt -- Adjust the path to the actual UnclaimPrompt
	local door = store.Door.door.door -- Adjust the path to the actual door object
	local claim = door.claim -- Assuming claim is a Value object within the door
	local name = door.name -- Assuming name is a Value object within the door

	local text = store.Sign.Sign
	local surfaceGui = text.SurfaceGui

	-- Function to handle unclaim logic
	local function handleUnclaim()
		if claim.Value == "true" then
			claimprox.Enabled = true
			claim.Value = "false"
			name.Value = ""
			door.CanCollide = true
			if surfaceGui then
				local textLabel = surfaceGui:FindFirstChild("TextLabel")
				if textLabel then
					textLabel.Text = "UNCLAIMED!"
				end
			end
		end
	end

	RemoteEvent.OnClientEvent:Connect(function()
		unclaimprox.Enabled = true
		handleUnclaim()
	end)
end)

	
end

Might be that the part is unanchored and its cancollide property is set to false so it falls trough the ground and into the void. Is that the case?

Yep that can be the case too.

Or it’s actually because the part doesn’t exist

KarilbolCoolCold there is a problem can you help me agin lol

yes. But make another topic so it’s about another thing

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