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

check if a player has called an event and is in a certain area???

im trying to do a thing where a local script calls an event when mouse3 is pressed it should open a door but only if you are touching a certain part

local callDoor = game.ReplicatedStorage:WaitForChild("callDoor")
local anim = script:WaitForChild("Animation")
local hum = script.Parent:WaitForChild("Humanoid")
local playanim = hum:LoadAnimation(anim)

local clickArea = script.Parent.ClickArea

callDoor.OnServerEvent:Connect(function()
--i need help here
end)

any help? :)

1 comment

0

Is mouse3 the scroll wheel button

1 answer

✓ Accepted answer
local part = whereisit
local woop = false

for i,v in pairs(part:GetTouchingParts()) do
	if game.Players:FindFirstChild(v.Parent.Name) then
		woop = true
	end
end

if woop == true then
	return true
else
	return false
end

1 comment

0

I'm sure I annotated this, but eh, GetTouchingParts on the part will allow you to see what player is touching it with simple script.Parent trickery.

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