I Have a local script inside StarterPlayerScripts.
So there are games that whenever you are in a certain region3, you may get a pop up GUI that says like Press E to "" and just things like that. I am trying to replicate this with my script although
when I try to see / visualize the region3 by creating a part with the regions CFrame and Size
the part is not visible and non-existent. I also need help with how to overlap / integrate my userinput of the key "E" Into that region script so that if a player is detected in the region, for the amount of time they can press E and the cameraMode() function will happen but only while they are in my region.
My script ;
-- Made By AltNature
-- What we want to do -- [ 1. When you enter the brick , bring up the gui ]
--[[ "Press E to open shop" , Player clicks "E" Then transitions into custom camera mode like Mining simulator
to choose your weapon. ]]--
-- // Variables \\ --
local f = workspace.CameraParts
local debounce = false
local touchpart = workspace.TouchZoneBlock
local check = true
local pressE = game.Players.LocalPlayer.PlayerGui:WaitForChild("gunShopGUI"):WaitForChild("pressE")
local userInput = game:GetService("UserInputService")
local cameras = {f.Revolver,
f.G36C,
f.GoldRevolver,
f.USP,
f.HK417,
f.FP6,
f.MG4,
f.AWM_F}
local Camera = workspace.Camera
-- // Functions \\ --
function cameraMode()
local target
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CameraSubject = target
wait()
local target = cameras[1]
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = target.CFrame
end
function exitCameraMode()
end
-- // The Activation \\ --
local region = Region3.new(Vector3.new(1,1,1), Vector3.new(10,10,10))
local part = Instance.new("Part")
part.Anchored = true
part.Size = region.Size
part.CFrame = region.CFrame
part.CanCollide = false
part.Transparency = 0.5
part.BrickColor = BrickColor.new("Persimmon")
while true do
wait(1)
local partsInRegion = workspace:FindPartsInRegion3(region, part, 1000)
for i, part in pairs(partsInRegion) do
if part.Parent:FindFirstChild("Humanoid") ~= nil then
end
end
end
userInput.InputBegan:Connect(function(input, gp) -- If they click "E" , then cameraMode()
if input.KeyCode == Enum.KeyCode.E then
if not gp then
cameraMode()
pressE.Visible = false
end
end
end)
-- // Manuvering through the GUI shop \\ --
