Without proximity prompt door system like Granny!
COMMUNITY QUESTION
If I look at the door and press the letter 'E' something happens! Can anyone help me?
1 answer
You can put like a BoolValue in your doors and then make a localscript.
In that script you can use UserInputService, use Mouse.Target to check if the player's mouse is pointing over a door then use DistanceFromCharacter to check the player's distance from the door.
Something like this:
local player = game:GetService("Players").LocalPlayer
local mouse = player:GetMouse()
local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(input, gameProcessedEvent)
if gameProcessedEvent then return end
if input.KeyCode == Enum.KeyCode.E then
if mouse.Target then
if mouse.Target:FindFirstAncestorOfClass("Model"):FindFirstChild("Door") then
local distance = player:DistanceFromCharacter(mouse.Target.Position)
if distance < 30 then
-- Open the door using TweenService
end
end
end
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
