ok so i have tried asking on the discord but im being ignored there so ima try again here. basically this is a basic crate opening script. the game is single player so im using on server event instead of client. Im not getting any errors. im gonna write what works and what doesnt in the script.
local RemoteEvent = game.ReplicatedStorage:WaitForChild("OpenCrate")
RemoteEvent.OnServerEvent:Connect(function()
--// Variables
local plr = game.Players:WaitForChild(game.Workspace:WaitForChild("PlayerName").Value)
local plrgui = plr:WaitForChild("PlayerGui")
local cratedrops = plrgui.CrateDrops
local crates = plrgui.Crates.Crates
local curcrate = plrgui.Crates.CurrentCrate
--//
crates.Visible = false -- this doesnt work
curcrate.Visible = false -- this doesnt work
curcrate.CrateNameValue.Value = "not chosen" -- this works
curcrate.CrateImage.Image = crates.BasicCrate.ImageLabel.Image -- this works
curcrate.Amount.Text = "You Own 0" -- this works
curcrate.Currency.Value = 50 -- this works
curcrate.PriceValue.Value = 0 -- this works
curcrate.BoxName.Text = "Choose A Crate" -- this works
if curcrate.CrateNameValue.Value == "Basic" then -- this doesnt work even tho the value is Basic (so everything in the if doesnt work aswell)
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 -- variable which will be the item player will get from a crate
if plr:WaitForChild("Crates"):WaitForChild("Basic").Value >= 1 then -- doesnt work even if 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 will be appreciated

1 comment
pls i just want it to work