Script only lets players go in elevator once

I have a server script inside that detects if a player goes into the elevator:

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild('Humanoid') then

	print('touched by '.. hit.Parent.Name)

local partyowner = game.Players[script.Parent:GetAttribute('Owner')]
		if not partyowner.PartyList:FindFirstChild(hit.Parent.Name) then
			print('2')
			local partyplayer = Instance.new('StringValue', partyowner.PartyList)
			partyplayer.Name = hit.Parent.Name
			local player = game.Players:GetPlayerFromCharacter(hit.Parent)
			player.Character.HumanoidRootPart.Position = script.Parent.Position
			player.Character.Humanoid.WalkSpeed = 0
			player.PlayerGui.LeaveGui.Leave.Visible = true
			player.InPlayersParty.Value = script.Parent:GetAttribute('Owner')
		end

	end
end)

When they leave the party it doesnt allow them to join back.

Leave Local Script:

local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
	local partyowner = game.Players[player.InPlayersParty.Value]
	partyowner.PartyList[player.Name]:Destroy()
	player.InPlayersParty.Value = ''
	script.Parent.Visible = false
	player.Character.HumanoidRootPart.CFrame = workspace.LeaveTeleport.CFrame
	player.Character.Humanoid.WalkSpeed = 16
	
end)

Video: https://streamable.com/xdlk8b

It also prints print('touched by '.. hit.Parent.Name) this piece of code the other times they try to join.

all of your prints use ' and not ", heres what you put:

print('hi')

it should be:

print("hi")

I’m pretty sure its the same thing?

i dont think so, heres your script when all of these things are fixed

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then

	print("touched by ".. hit.Parent.Name)

local partyowner = game.Players[script.Parent:GetAttribute("Owner")]
		if not partyowner.PartyList:FindFirstChild(hit.Parent.Name) then
			print("2")
			local partyplayer = Instance.new("StringValue", partyowner.PartyList)
			partyplayer.Name = hit.Parent.Name
			local player = game.Players:GetPlayerFromCharacter(hit.Parent)
			player.Character.HumanoidRootPart.Position = script.Parent.Position
			player.Character.Humanoid.WalkSpeed = 0
			player.PlayerGui.LeaveGui.Leave.Visible = true
			player.InPlayersParty.Value = script.Parent:GetAttribute("Owner")
		end
	end
end)

try it out and see if it works

No difference, it still only lets them in once

I fixed the issue, It wasnt server sided

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