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

Why does the script do nothing, even though the conditions are met?

Asked by 2 years ago

Here's the code:

local Player = game:GetService("Players").LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")
local desc = PlayerGui.Collection:WaitForChild("Description")
local descr = PlayerGui.Collection.Description:WaitForChild("Descr")
local hint = PlayerGui.Collection.Description:WaitForChild("Hint")
local rarity = PlayerGui.Collection.Description:WaitForChild("Rarity")
local rarinfo = PlayerGui.Collection.Description:WaitForChild("Hinfolon")

desc.ImageLabel.Image = ("8179043880")
descr.TextStrokeTransparency = ("1")
descr.TextTransparency = ("1")
hint.TextStrokeTransparency = ("1")
hint.TextTransparency = ("1")
rarity.TextStrokeTransparency = ("1")
rarity.TextTransparency = ("1")
rarinfo.TextStrokeTransparency = ("1")
rarinfo.TextTransparency = ("1")

script.Parent.MouseButton1Down:Connect(function()
    hint.Text = script.Parent.Hint.Value
    hint.TextStrokeTransparency = ("0")
    hint.TextTransparency = ("0")
    rarity.Text = script.Parent.Rarity.Value
    rarity.TextStrokeTransparency = ("0")
    rarity.TextTransparency = ("0")
    rarinfo.TextStrokeTransparency = ("0")
    rarinfo.TextTransparency = ("0")
    if script.Parent.Collected.Value == true then
        desc.Active = true
        desc.Visible = true
        desc.ImageLabel.Image = script.Parent.Image
        desc.ImageLabel.Visible = true
        desc.ImageLabel.Active = true
        descr.Visible = true
        descr.Text = script.Parent.Description.Value
        descr.TextStrokeTransparency = ("0")
        descr.TextTransparency = ("0")
        print("It's done!")
    else
        print("Nopeydoodles")
    end
end)

(LocalScript)

(Line 28) When I run this script and click, the script prints "Nopeydoodles" although "script.Parent.Collected" is ticked ("Collected" is a BoolValue). I checked the value in the PlayerGui and StarterGui while playtesting, and they're both ticked, meaning when I click it should work, right? Well I don't know since I'm not that good at scripting soooo... can any of you help? Thanks!

Answer this question