Ready platform glitching out

  1. What do you want to achieve?
    I want to make a platform where if you stand on it you get added to a ready to leave list.
  2. What is the issue?
    The current method I use to detect if a player has entered the ready platform is really bad (im using .Touched and .TouchEnded), I know I shouldn’t be using Touch events for this, but I have no idea what else to use.
  3. What solutions have you tried so far?
    I have tried using more collision checks, but nothing worked, not sure what to search on google to find solutions.
script.Parent.Touched:Connect(function(hit)
	if hit.Parent.Parent:FindFirstChildOfClass("Humanoid") then

		local char = hit.Parent.Parent -- makes a var for the character

		if char then

			local plr = game.Players:GetPlayerFromCharacter(char) -- makes a var for the player kinda useless

			if plr and not table.find(playersLeaving, plr) then
				table.insert(playersLeaving, plr)

				local newTemp = temp:Clone()
				newTemp.Name = plr.Name
				newTemp.username.Text = plr.Name

				if plrPfps[plr.Name] == nil then
					local content, isReady = game.Players:GetUserThumbnailAsync(plr.UserId, thumbType, thumbSize)
					newTemp.Pfp.Image = content
					plrPfps[plr.Name] = content
				else
					newTemp.Pfp.Image = plrPfps[plr.Name]
				end

				newTemp.Parent = GUI.SurfaceGui.Frame.ScrollingFrame
			end
		end
	end
end)

script.Parent.TouchEnded:Connect(function(hit)
	if hit.Parent.Parent:FindFirstChildOfClass("Humanoid") then

		local char = hit.Parent.Parent -- makes a var for the character

		if char then

			local plr = game.Players:GetPlayerFromCharacter(char) -- makes a var for the player kinda useless

			if plr and table.find(playersLeaving, plr) ~= nil then
				table.remove(playersLeaving, table.find(playersLeaving, plr))
				local gui = GUI.SurfaceGui.Frame.ScrollingFrame:FindFirstChild(plr.Name)
				if gui then gui:Destroy() end
			end
		end
	end
end)



(The almost transparent, big, gray block is the parent of the script)

You can try using Region3 or a module that uses this function - ZonePlus
Guide for Region3: How to detect if player entered/left region3?
Region3 tutorial (Easy Difficulty)

2 Likes

You could use raycasting,
and by that I mean shooting a raycast from the character facing downwards, checking which part it hit, and if it’s the I’m Ready part, set them as Ready

1 Like

Thanks, this seems to work without any flaws.

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