#Egg Issues

1 messages · Page 1 of 1 (latest)

ionic dagger
#

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remote = ReplicatedStorage:WaitForChild("BuyEggEvent")

remote.OnServerEvent:Connect(function(player)

--common egg script
local leaderstats = player:FindFirstChild("leaderstats")
if leaderstats then
local wins = leaderstats:FindFirstChild("Wins")

    print(wins)
    if wins then
        print("wins : ", wins.Value)
        
    if wins.Value >= 10 then
        wins.Value = wins.Value - 10
        print(player, "has bought a common egg")
    else
        print(player, "has not enough wins")
    end
    end
end

end)

--uncommmonEgg script

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remote = ReplicatedStorage:WaitForChild("BuyEggEvent")

remote.OnServerEvent:Connect(function(player)

local leaderstats = player:FindFirstChild("leaderstats")
if leaderstats then
    local wins = leaderstats:FindFirstChild("Wins")

    print(wins)
    if wins then
        print("wins : ", wins.Value)

        if wins.Value >= 50 then
            wins.Value = wins.Value - 50
            print(player, "has bought a uncommon egg")
        else
            print(player, "has not enough wins for uncommon egg !")
        end
    end
end

end)

#

--script rare egg

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remote = ReplicatedStorage:WaitForChild("UncommonEggEvent")

remote.OnServerEvent:Connect(function(player)

local leaderstats = player:FindFirstChild("leaderstats")
if leaderstats then
    local wins = leaderstats:FindFirstChild("Wins")

    print(wins)
    if wins then
        print("wins : ", wins.Value)

        if wins.Value >= 100 then
            wins.Value = wins.Value - 100
            print(player, "has bought a uncommon egg")
        else
            print(player, "has not enough wins for rare egg !")
        end
    end
end    

end)

local RemoteEvent: RemoteEvent = ("BuyEggEvent")

--
RemoteEvent:FireServer(100)
RemoteEvent:FireServer(150)
RemoteEvent:FireServer(15)

silent sparrow
#

wtf is your problem

wild surge
#

where problem

ionic dagger
ionic dagger
#

i tried diff script and diff remotes but it didnt worked

wild surge
#

is your wins count high enough?

candid stump
#

just use 1 RemoteEvent and 1 ServerScript

#

you don't need a script for each egg

wild surge
candid stump
#

:FireServer("Common", 100)
or
:FireServer("Uncommon", 150)

remote.OnServerEvent:Connect(function(player, rarity, price)
    local leaderstats = player:FindFirstChild("leaderstats")
    if not leaderstats then return end

    local wins = leaderstats:FindFirstChild("Wins")
    print(wins)
    if not wins then return end

    print("wins : ", wins.Value)

    if wins.Value >= price then
        wins.Value -= price
        print(player, `has bought a {rarity} egg`)
    else
        print(player, `has not enough wins for {rarity} egg !`)
    end
end
ionic dagger
#

where does the rarity gets done ?

candid stump
#

you can pass the price in arguments too

ionic dagger
#

okayy i see and how does [rarity} gets called on my script ?

candid stump
#

you just print it

ionic dagger
#

it will say which egg im clicking on ?

candid stump
candid stump
#

which egg you buy and if you don't have enough money for it

ionic dagger
#

oh okay thanks btw for rarity i need to do 3 rarity local then right ? (Common, Uncommon and rare)

topaz groveBOT
#

studio** You are now Level 10! **studio

candid stump
#

and ofc here you can add logic that adds pet in your inv or smth like that

ionic dagger
#

alr thanks ill try that

candid stump
#

you use proximityprompts?

ionic dagger
#

btw another subject do you know how i can make the ui on top of each eggs ?

ionic dagger
candid stump
ionic dagger
#

you are the goat thank youu

#

now i will be able to connect both lol, i will be able to remove the proximity prompt

candid stump
#

uh

#

when you get close, it will activate billboardgui and then if you press E or click on button for example you will fire a RemoteEvent

#

👍

candid stump
#

cool

#

gl

ionic dagger
#

thanks wish me luck hopefully it works evilcat