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

Why won't this scrolling frame scroll on KeyDown?

Asked by 10 years ago

I am making something for a game, and for some reason, the script returns with no errors, but it does nothing. I have tried scrolling it all the way, finding the position, and scrolling it back. Nothing will work for me. It is supposed to be when you hit a button, it will scroll a 4th of the way in either direction, and change the tool value.

I have pictures here of what it looks like: In game: http://imgur.com/vWce8yc,8CUxw25 In the explorer: http://imgur.com/vWce8yc,8CUxw25#1

Here is the code:

01game.StarterGui:SetCoreGuiEnabled(4, false)
02Player = game.Players.LocalPlayer
03Mouse = Player:GetMouse()
04 
05Size = script.Parent.AbsoluteWindowSize
06Rsize = Size/4
07 
08Mouse.KeyDown:connect(function(key)
09    if key == "e" then
10        for Scroll = 1,5 do
11        script.Parent.CanvasPosition = script.Parent.CanvasPosition +Vector2.new(Rsize, 0)
12        end
13        if script.Parent.SelectedTool.Value ~= 4 then
14            script.Parent.SelectedTool.Value =  script.Parent.SelectedTool.Value +1
15        end
View all 27 lines...

1 answer

Log in to vote
1
Answered by 10 years ago

I just basically copied this from the Roblox wiki lesson. Here's the code to this or link

01-- In a LocalScript in StarterGui:
02 
03-- Create ScreenGui
04local screenGui = Instance.new("ScreenGui")
05screenGui.Parent = script.Parent
06 
07-- Create ScrollingFrame
08local scrollingFrame = Instance.new("ScrollingFrame")
09scrollingFrame.Parent = screenGui
10scrollingFrame.Position = UDim2.new(0.2, 0, 0.1, 0)
11scrollingFrame.Size = UDim2.new(0, 200, 0, 100)
12scrollingFrame.CanvasSize = UDim2.new(0, 600, 2, 0)
13scrollingFrame.BackgroundColor3 = BrickColor.White().Color
14scrollingFrame.BottomImage = "rbxassetid://156476249"
15scrollingFrame.MidImage = "rbxassetid://156476256"
View all 53 lines...

http://wiki.roblox.com/index.php?title=Scrolling_Frame_Tutorial

0
You misunderstood. I need the position of the frame to move when someone hits a key. I need a way to do that. MisaMiner 50 — 10y
0
well look on this page to help you :) GreekGodOfMLG 244 — 10y
Ad

Answer this question