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

Why doesnt this work? Read Problem

Asked by 10 years ago

PROBLEM: I was trying to make it so if I press a certain key the gui will slide onto the screen (using gui animations) but it didnt work can anybody help to try to figure out the problem plus im a starter to scripting.

local Frame = script.Parent.Frame
local Box = Frame.Box
local Button = Frame.Button


Player = script.Parent.Parent
mouse = Player:GetMouse()


local Animate = function(Frame, EndPos, EndSize, Direction, Style, Time, OR, Type) -- Frame, UDim2, easingDirection, easingStyle, float [time], bool [override], TypeOfAnimation
    if Type == "Position" then
        return Frame:TweenPosition(EndPos, Direction, Style, Time, OR)
    elseif Type == "Size" then
        return Frame:TweenSize(EndSize, Direction, Style, Time, OR)
    elseif Type == "SizeAndPosition" then
        return Frame:TweenSizeAndPosition(EndPos, EndSize, Direction, Style, Time, OR)
    end
end

function onKeyDown(key)
    key = key:lower()
if script.Parent.Open.Value == false then
    if key == "e" then
Box.Position = UDim2.new(-2,0,0,0)
Animate(Box,UDim2.new(0.150,0,0,0), UDim2.new(0.25, 0, 0.25, 0), "Out", "Back", 2, true, "Position")
        end
    end
end

mouse.KeyDown:connect(onKeydown)
0
Is this in a LocalScript? Also, is it in either the StarterGui or StarterPack? Muoshuu 580 — 10y
1
Maybe try not returning the animation and just making it play? Perci1 4988 — 10y
0
yes this is a local script and it is inside the gui and the gui is in startergui AWESOMEnoob3 3 — 10y

Answer this question