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

How can i Re-Script this?

Asked by 10 years ago

So anyways i'm trying to Re-Script a helmet i have to where instead of clicking the "off" or "on" Gui's i can just press "e" or "q". The hierarchy of the helmet is this

Tactical Helmet V.2

Helmet Head FlashGui(Important one) ?Frame ?AO Flash so anyways i tried to Re-script this by trying this but it won't work

local P = script.Parent.Parent.Parent.Parent.Parent.Name
local HLoc = workspace:FindFirstChild(P)
wait(1)
local Helmet = HLoc:findFirstChild("Helmet")
if Helmet ~= nil then
    local Light = Helmet:FindFirstChild("Light")
    function onKeyDown(key)
        key = key:lower()
        if key == "r" then
        Light.Torch.Angle = 90
        Light.Torch.Brightness = 0
        Light.Torch.Range = 20
        Light.Torch.Color = Color3.new(255,255,255)
        Light.Torch.Enabled = false
    end
end

mouse.KeyDown:connect(onKeyDown)

0
whops just noticed the hierarchy messed up. purplemetro3421 5 — 10y

Answer this question