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

(I solved this myself) My frame is not Tweening properly?

Asked by
zane21225 243 Moderation Voter
3 years ago
Edited 3 years ago

Hello all, I decided to experiment with the UserInputService and assign a few keybinds to kill the player.

Here is where the script tweens the frame:

-- tween functions:
local function tweenIn()
    script.Parent:TweenPosition(UDim2.new(0.202,0,0.117,0),  "In", "Quad", 1)
end

local function tweenOut()
    script.Parent:TweenPosition(UDim2.new(0.202,0,1.1,0), "In", "Quad", 1)
end

Here is where the script detects the KeyCode & calls the Functions:

local userInputService = game:GetService('UserInputService')

local openKey = Enum.KeyCode.R
local approveKey = Enum.KeyCode.Y
local disapproveKey = Enum.KeyCode.N

userInputService.InputBegan:Connect(function(key)
    if key.KeyCode == openKey and script.Parent.Visible == false then
        tweenIn()
    elseif key.KeyCode == approveKey and script.Parent.Visible == true then
        tweenOut()
        killPlayer:FireServer()
    elseif key.KeyCode == disapproveKey and script.Parent.Visible == true then
        tweenOut()
    end
end)

Thanks for your assistance!

0
What specifically do you mean by "not Tweening properly?" Memotag 226 — 3y
0
I would recommend using TweenInfo if you are going to add all the in, out, quad, quint, etc matiss112233 258 — 3y

Answer this question