I'm trying to make a RemoteEvent fire when a player presses 'e' when in a certain distance of the brick. I'm uncertain on how I :GetMouse() and this is a LocalScript for FilteringEnabled. Does anyone know how to fix this?
for _,v in pairs(game.Players:GetPlayers()) do
mouse = v:GetMouse()
end
debounce = false
Object = script.Parent
mouse.KeyDown:connect(function(key)
for i,v in pairs(game.Players:GetPlayers()) do
distance = 5
if (v.Torso.Position - Object.Position).magnitude <= distance then
if (key:lower()) == "e" and not debounce then
debounce = true
game.ReplicatedStorage.Found_Phone:FireServer()
script.Parent:Destroy()
end
end
end
end)

3 comments
It doesn't seem to work. I'm not getting an output error either
Oh sorry... I found my error! Let me edit that!
Edited, please let me know if it still doesn't work!