ok i know the script is kinda long but its pretty basic as u look deeper into it. im not getting any errors.

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
    curcrate.Visible = false
    curcrate.CrateNameValue.Value = "not chosen"
    curcrate.CrateImage.Image = crates.BasicCrate.ImageLabel.Image
    curcrate.Amount.Text = "You Own 0"
    curcrate.Currency.Value = 5
    curcrate.PriceValue.Value = 0
    curcrate.BoxName.Text = "Choose A Crate"

    if curcrate.CrateNameValue.Value == "Basic" then
        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
            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)

so basically the first lines of the script work:

    crates.Visible = false -- this one deosnt work
    curcrate.Visible = false -- this one deosnt work aswell
    curcrate.CrateNameValue.Value = "not chosen" -- but this one and these lines below work
    curcrate.CrateImage.Image = crates.BasicCrate.ImageLabel.Image
    curcrate.Amount.Text = "You Own 0"
    curcrate.Currency.Value = 5
    curcrate.PriceValue.Value = 0
    curcrate.BoxName.Text = "Choose A Crate"

no idea whats happening

4 comments

0

What's the problem?

0

it doesnt give player the item, the gui doesnt disappear, the animation gui doesnt appear and stuff however i cant see any problems in the script

0

I don't think accessing the playergui from a server script is a good idea. Try making it appear from the client.

0

its a remote event script which is fired by a local script