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

Major GUI Issue (not activating properly)?

Asked by
RoboFrog 400 Moderation Voter
9 years ago

I had asked a question nearly identical to this recently, however it was a bit intimidating since the code in question was so long. So, since I received no answers, I went ahead and trimmed the question down to only the necessary parts. So, here's the rest of the old question, with the new code format:

Alright, I've been working on a pickaxe script for a while, and everything was working nicely until today. the main portion of the script functions perfectly and without any error. The problem arises with a script to display the name of the ore, which gives me so many errors.

The ore display isn't working correctly (not going visible) and to my knowledge it isn't following the mouse, either. The color doesn't seem to be changing properly, and I can't rightfully say for the text, either.

  • It's not moving properly with the mouse.
  • It isn't shutting off or waiting properly
  • It's activating too frequently
  • It's not distinguishing model names correctly (activating when mousing over stuff it shouldn't)
  • The if statements don't seem to be working like they should.
  • And more that I can't really think of.

  • This is also all in a local script inside of the pickaxe tool!

local mouse = game.Players.LocalPlayer:GetMouse()
local gui3true = game.Workspace.Model3.gui3true.Value -- A boolean value, default == false

mouse.Move:connect(function()
    local gui = game.Lighting.Gui3
    local gui3 = game.Players.LocalPlayer.PlayerGui.Gui3
    gui3.Text.Position = UDim2.new(mouse.X, mouse.Y)
    if mouse.Target.Parent.Name == "Stone" or "Copper" or "Tin" or "Silver" or "Gold" or "Platinum" then
    game.Players.LocalPlayer.PlayerGui.Gui3.Text.Visible = true 
    gui.Text.Text = (tostring(mouse.Target.Parent.Name))
    print("Target is an ore")
    if gui3true == true then print("gui3true is true!") wait(1) end
    if gui3true == false then print ("gui3true is false!")

    if mouse.Target.Parent.Name == "Stone" then
        gui3.Text.Visible = true
        print ("I know you're stone, dude...")
        gui3.Text.Text = "Stone Ore"
        gui3.Text.BackgroundColor3 = Color3.new(158, 158, 158)
        gui3true = true
        wait(1)
        gui3true = false
        gui3.Text.Visible = false

    elseif mouse.Target.Parent.Name == "Copper" then
        gui3.Text.Visible = true
        gui3.Text.Text = "Copper Ore"
        gui3.Text.BackgroundColor3 = Color3.new(209, 160, 0)
        gui3true = true
        wait(1)
        gui3true = false
        gui3.Text.Visible = false

    elseif mouse.Target.Parent.Name == "Tin" then
        gui3.Text.Visible = true
        gui3.Text.Text = "Tin Ore"
        gui3.Text.BackgroundColor3 = Color3.new(196, 196, 161)
        gui3true = true
        wait(1)
        gui3true = false
        gui3.Text.Visible = false

    elseif mouse.Target.Parent.Name == "Silver" then
        gui3.Text.Visible = true
        gui3.Text.Text = "Silver Ore"
        gui3.Text.BackgroundColor3 = Color3.new(196, 196, 196)
        gui3true = true
        wait(1)
        gui3true = false
        gui3.Text.Visible = false

    elseif mouse.Target.Parent.Name == "Gold" then
        gui3.Text.Visible = true
        gui3.Text.Text = "Gold Ore"
        gui3.Text.BackgroundColor3 = Color3.new(235, 235, 52)
        gui3true = true
        wait(1)
        gui3true = false
        gui3.Text.Visible = false

    elseif mouse.Target.Parent.Name == "Platinum" then
        gui3.Text.Visible = true
        gui3.Text.Text = "Platinum Ore"
        gui3.Text.BackgroundColor3 = Color3.new(237, 237, 237)
        gui3true = true
        wait(1)
        gui3true = false
        gui3.Text.Visible = false

    else print("Wrong target!")
        game.Players.LocalPlayer.PlayerGui.Gui3.Text.Visible = false 
    end
    end
    end
end)

Now, for the important part -- the output errors and statements:

  • It prints this constantly whenever my mouse moves over something that's not listed as an ore (baseplate, shops, et cetera)(At extremely rapid pace):

    • Target is an ore
    • gui3true is false!
    • Wrong target!
  • Whenever I move it over an ore, it repeats this constantly (At extremely rapid pace):

    • Target is an ore
    • gui3true is true!
  • Whenever I roll over a model called "Stone", it implements its print correctly, but doesn't activate anything else.

If you need any other scenarios for output, please let me know. I'm sure I'm forgetting some that are important.

Like always, thank you for reading, and any help possible is greatly appreciated!

Answer this question