Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago

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? :)

0
Is mouse3 the scroll wheel button AltNature 169 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago

Please provide explanation with your answers. Simply posting code does not spread knowledge of integral scripting processes which helps people understand the logic and reasoning behind your 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
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. MachoPiggies 526 — 5y
Ad

Answer this question