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

LocalScript put in StarterGui Won't Work, Why?

Asked by 9 years ago

Hello, I have only one script inserted in the game, and it is a LocalScript located in the StarterGui for a GUI. When I test the game locally, my GUI and it's function work, but when I test it using the actual test button, my Gui isn't there. Can someone please help with why this might be happening? Thanks for reading. Here is the script:

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local screenGui = Instance.new("ScreenGui")
local goAgain = true
player.Character.Humanoid.WalkSpeed = 30
screenGui.Parent = script.Parent
local TextLabel = Instance.new("TextButton")
TextLabel.Parent = screenGui
TextLabel.Position = UDim2.new(0, 700, 0, 310)
TextLabel.Size = UDim2.new(0, 150, 0, 50)
TextLabel.BackgroundColor3 = BrickColor.Green().Color
TextLabel.Text = "Jump is ready."
function onSpace(key)
    key = key:lower()       
    if key == "e" and goAgain == true then
        player.Character.Humanoid.JumpPower = 250
        player.Character.Humanoid.Jump = true       
        goAgain = false         
        TextLabel.BackgroundColor3 = BrickColor.Red().Color
        TextLabel.Text = "Jump Restarting..."                           
        wait(5) 
        TextLabel.BackgroundColor3 = BrickColor.Green().Color
        TextLabel.Text = "Jump is ready."
        goAgain = true      
    end
    if goAgain == false then    
    player.Character.Humanoid.JumpPower = 55
    end
    end
mouse.KeyDown:connect(onSpace)
0
What's the script? Kyokamii 133 — 9y
0
Here we go, I edited it back in. yoman1776 85 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local screenGui = Instance.new("ScreenGui")
local goAgain = true
player.Character.Humanoid.WalkSpeed = 30
screenGui.Parent = script.Parent
local TextLabel = Instance.new("TextButton")
TextLabel.Parent = screenGui
TextLabel.Visible=true--Don't forget we need it to be visible.
TextLabel.Position = UDim2.new(0, 700, 0, 310)--Make sure your position
TextLabel.Size = UDim2.new(0, 150, 0, 50)--And size are mathematically correct.
TextLabel.BackgroundColor3 = BrickColor.Green().Color
TextLabel.Text = "Jump is ready."
function onSpace(key)
    key = key:lower()       
    if key == "e" and goAgain == true then
        player.Character.Humanoid.JumpPower = 250
        player.Character.Humanoid.Jump = true       
        goAgain = false         
        TextLabel.BackgroundColor3 = BrickColor.Red().Color
        TextLabel.Text = "Jump Restarting..."                           
        wait(5) 
        TextLabel.BackgroundColor3 = BrickColor.Green().Color
        TextLabel.Text = "Jump is ready."
        goAgain = true      
    end
    if goAgain == false then    
    player.Character.Humanoid.JumpPower = 55
    end
    end
mouse.KeyDown:connect(onSpace)
Ad

Answer this question