still havent found the solution so ima ask again here perhaps someone will see it. so basically this is a remote event script to open crates. im not getting any errors. heres the script im gonna describe what works and what doesnt.

local RemoteEvent = game.ReplicatedStorage:WaitForChild("OpenCrate")
RemoteEvent.OnServerEvent:Connect(function(plr)

    --// Variables
	local plrgui = plr:WaitForChild("PlayerGui")
    local cratedrops = plrgui.CrateDrops
	local crates = plrgui.Crates.Crates
	local curcrate = plrgui.Crates.CurrentCrate

    --//
    crates.Visible = false -- doesnt work
    curcrate.Visible = false -- doesnt work
    curcrate.CrateNameValue.Value = "not chosen" -- works
    curcrate.CrateImage.Image = crates.BasicCrate.ImageLabel.Image -- works
    curcrate.Amount.Text = "You Own 0" -- works
    curcrate.Currency.Value = 50 -- works
    curcrate.PriceValue.Value = 0 -- works
    curcrate.BoxName.Text = "Choose A Crate" -- works

    if curcrate.CrateNameValue.Value == "Basic" then -- doesnt work even tho the value is "Basic"
        local basicdrops = plrgui.Crates.Crates.BasicCrate.Drops.Basic:GetChildren()
        local novadrops = plrgui.Crates.Crates.BasicCrate.Drops.Nova:GetChildren()
        local stardrops = plrgui.Crates.Crates.BasicCrate.Drops.Star:GetChildren()

        local choosenitem
        if plr:WaitForChild("Crates"):WaitForChild("Basic").Value >= 1 then -- doesnt work even if Basic value is more than 1
            plr:WaitForChild("Crates"):WaitForChild("Basic").Value = plr:WaitForChild("Crates"):WaitForChild("Basic").Value - 1

            local chance = math.random(1,100)
            if chance >= 15 then
                choosenitem = basicdrops[math.random(1,#basicdrops)]
            elseif chance < 15 and chance > 1 then
                choosenitem = novadrops[math.random(1,#novadrops)]
            elseif chance == 1 then
                choosenitem = stardrops[math.random(1,#stardrops)]
            end

            cratedrops.DropImage.Image = cratedrops.Drops:FindFirstChild(choosenitem.Name).Image
            cratedrops.DropName.Text = "You got "..choosenitem.Parent.Name .."Tier "..choosenitem.Name"!"
            cratedrops.DropImage.Visible = true
            cratedrops.DropName.Visible = true

            plr:FindFirstChild("Inventory"):FindFirstChild(choosenitem.Name).Value = plr:FindFirstChild("Inventory"):FindFirstChild(choosenitem.Name).Value + 1
            wait(4)
            cratedrops.DropImage.Visible = false
            cratedrops.DropName.Visible = false
        end
    end
end)

any help appreciated

4 comments

0

100000 question!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

0

ik

0

What type of value is CrateNameValue?

0

cratenamevalue is a string value