#rebirths

160 messages · Page 1 of 1 (latest)

summer dome
#
if plr.Touched == rebirth2 then
```i get this error, touched doesnt exist, do i use connect?
south robin
#

Touched are only part func

summer dome
#

oh

#

what do i do then

south robin
#

idk whats your intention

summer dome
#

im trying to make multiple reb pads now

#
Rebirths.Event:Connect(function(plr)
    
    local rebirth1 = workspace.StrengthForRebirth1.Head
    local rebirth2 = workspace.StrengthForRebirth2.Head
    
    if plr.Touched == rebirth1 then

        if plr.leaderstats.Strength.Value >= 100 then 

            local leaderstats = plr:FindFirstChild("leaderstats")
            local RebirthsMultiplier = leaderstats:FindFirstChild("RebirthsMultiplier")

            plr.leaderstats.Strength.Value = 0
            plr.leaderstats.Rebirths.Value += 1

            RebirthsMultiplier.Value += 2
        end
    end

    if plr.Touched == rebirth2 then

        if plr.leaderstats.Strength.Value >= 250 then 

            local leaderstats = plr:FindFirstChild("leaderstats")
            local RebirthsMultiplier = leaderstats:FindFirstChild("RebirthsMultiplier")

            plr.leaderstats.Strength.Value = 0
            plr.leaderstats.Rebirths.Value += 2

            RebirthsMultiplier.Value += 4
        end
    end
end)
south robin
#

where does the event come from, the same pad?

#

or diff pads

summer dome
#

diff pads

#

the 100 strength one

#

same pad

#

as last conversation

south robin
#

alright, and they have names like rebirth2 and rebirth1?

#

they fire the same event no?

summer dome
summer dome
south robin
#

alright, then let me a moment show u a very easy fix with a table

urban ermine
summer dome
#

the plr works

#

idk how to do touched

south robin
#

can u show me the script? of the pads

#

that fires it

#

the whole script if it can be

plush hamlet
#

Change plr.Touched == rebirth2 to, rebirth2.touched:Connect(function(plr))

#

The touched event should be used on the part not the player

south robin
plush hamlet
south robin
#

yup thats a big fail tho

#

he wants just like pads of cost and they give you like rebirths and multipliers.

#

so you can just do one func with a table that detects what the fired pad

plush hamlet
#

Yh

south robin
#

im just waiting for him to send the script

summer dome
#

you helped me

#
local Rebirth = game.ReplicatedStorage:WaitForChild("Rebirths")

script.Parent.Touched:Connect(function(hit)
    local player = game.Players:GetPlayerFromCharacter(hit.Parent) -- This get the players from the character.

    if not player then return end

    Rebirth:Fire(player)

end)
south robin
#

well, is deleted

south robin
#

¿?

summer dome
#

yeah

south robin
#

alright, then lemme do a quick thing and explain how to add more pads if you want to

south robin
#

oh

#

wait

plush hamlet
#

Same script lol

south robin
#
local Rebirth = game.ReplicatedStorage:WaitForChild("Rebirths")
local Part = script.Parent.Parent

script.Parent.Touched:Connect(function(hit)
    
    local player = game.Players:GetPlayerFromCharacter(hit.Parent) -- This get the players from the character.

    if not player then return end

    Rebirth:Fire(player, Part.Name)

end)
#

Nope

#

im firing the part name

#

im gonna test it let me a moment

plush hamlet
#

Should work

grizzled crescentBOT
#

studio** You are now Level 1! **studio

south robin
#

and the other script would be:

#
local Rebirths = game:GetService("ReplicatedStorage"):WaitForChild("Rebirths")

local RebirthPads = {
    ["StrengthForRebirth1"] = {
        ["RebirthGain"] = 1,
        ["RebirthMultiplierGain"] = 2,
        ["Cost"] = 100
    },
    ["StrengthForRebirth2"] = {
        ["RebirthGain"] = 2,
        ["RebirthMultiplierGain"] = 4,
        ["Cost"] = 250
    }
}

Rebirths.Event:Connect(function(plr, RebirthPadName)
            
    if plr.leaderstats.Strength.Value >= RebirthPads[RebirthPadName]["Cost"] then 

        local leaderstats = plr:FindFirstChild("leaderstats")
        local RebirthsMultiplier = leaderstats:FindFirstChild("RebirthsMultiplier")

        plr.leaderstats.Strength.Value = 0
        plr.leaderstats.Rebirths.Value += RebirthPads[RebirthPadName]["RebirthGain"]

        RebirthsMultiplier.Value += RebirthPads[RebirthPadName]["RebirthMultiplierGain"]
        
    end
    
end)
#

and to add u need to do like this:

#
local RebirthPads = {
    ["StrengthForRebirth1"] = {
        ["RebirthGain"] = 1,
        ["RebirthMultiplierGain"] = 2,
        ["Cost"] = 100
    },
    ["StrengthForRebirth2"] = {
        ["RebirthGain"] = 2,
        ["RebirthMultiplierGain"] = 4,
        ["Cost"] = 250
    }, 
    ["NameOfPad"] = {
        ["RebirthGain"] = "YourValueNumber",
        ["RebirthMultiplierGain"] = "YourValueNumber",
        ["Cost"] = "YourCostNumber"
    }
}

#

Just remember the " , "

#

If u put a bad " , " the script would crash

#

hope it helps

#

If u don't understand something or something gets an error tell me

summer dome
#

ok

#

i will learn this

#

and study

#

i test

#

rq

south robin
#

yes, table are like god

summer dome
#

it works

#

i need to learn more

#

😦

south robin
#

niceee, this is like automatic, you just need to add like my explanation

#

dw!, this takes time, but times will give you the reward

summer dome
#

ty

#

wait

#

how do i hide smth in leaderstats

#
game.Players.PlayerAdded:Connect(function(player)
    local leaderstats = Instance.new("Folder", player)
    leaderstats.Name = "leaderstats"

    local Strength = Instance.new("IntValue", leaderstats)
    Strength.Name = "Strength"
    Strength.Value = 0

    local Rebirths = Instance.new("IntValue", leaderstats)
    Rebirths.Name = "Rebirths"
    Rebirths.Value = 0

    local RebirthsMultiplier = Instance.new("IntValue", leaderstats)
    RebirthsMultiplier.Name = "RebirthsMultiplier"
    RebirthsMultiplier.Value = 0

end)
south robin
#

u want to hide the rebirthmultiplier ?

summer dome
#

i dont want rebmulti to show

south robin
#

you know

summer dome
#

yeah

south robin
#

you dont need to create that

#

where do you use rebirthmultiplier?

#

can i see

#

please

#
game.Players.PlayerAdded:Connect(function(player)
    local leaderstats = Instance.new("Folder", player)
    leaderstats.Name = "leaderstats"

    local Strength = Instance.new("IntValue", leaderstats)
    Strength.Name = "Strength"
    Strength.Value = 0

    local Rebirths = Instance.new("IntValue", leaderstats)
    Rebirths.Name = "Rebirths"
    Rebirths.Value = 0

end)

Delete

#

and show me the scripts where rebirthmult is used

#

to optimize.

summer dome
#

k

south robin
#

no more?

#

like maybe strength gain

#

use it

#

or any other script

summer dome
#

k

plush hamlet
#

Could use a intvalue if you don’t want it to show

south robin
#

well, as i can see the rebirthmult is just rebirth x2 so in the scripts where he uses it just use the rebirths x 2

#

and you can delete the rebirthmult value

plush hamlet
#

Yh

summer dome
#

how use rebirths x2 tho, should i use local???

#

like set a variable to x2 rebirths

south robin
#

mmmm you can in the scripts where u use it

#

imagine u use it like this

#

Strength.Value += 1 * RebirthMultiplier

#

imagine

#

well, you just do

#

Strength.Value += 1 + (Rebirth.Value * 2)

#

With the names of your rebirth obviusly and all in your way

#

but that would optimize a lot and obviusly delete the annoying stat showing on the leaderstats

summer dome
#

fixed it

#

i just added rebirt.value *2 to sterngt.value

south robin
#

nice, with that u only need rebirth value

grizzled crescentBOT
#

studio** You are now Level 9! **studio

south robin
#

u edited this?

summer dome
#

jeez my typing

#

nah

south robin
#
local Rebirths = game:GetService("ReplicatedStorage"):WaitForChild("Rebirths")

local RebirthPads = {
    ["StrengthForRebirth1"] = {
        ["RebirthGain"] = 1,
        ["RebirthMultiplierGain"] = 2,
        ["Cost"] = 100
    },
    ["StrengthForRebirth2"] = {
        ["RebirthGain"] = 2,
        ["RebirthMultiplierGain"] = 4,
        ["Cost"] = 250
    }
}

Rebirths.Event:Connect(function(plr, RebirthPadName)
            
    if plr.leaderstats.Strength.Value >= RebirthPads[RebirthPadName]["Cost"] then 

        local leaderstats = plr:FindFirstChild("leaderstats")
        local RebirthsMultiplier = leaderstats:FindFirstChild("RebirthsMultiplier")

        plr.leaderstats.Strength.Value = 0
        plr.leaderstats.Rebirths.Value += RebirthPads[RebirthPadName]["RebirthGain"]

        RebirthsMultiplier.Value += RebirthPads[RebirthPadName]["RebirthMultiplierGain"]
        
    end
    
end)
summer dome
#

just my typing lol messed up

south robin
#

i can just quick fix

#
local Rebirths = game:GetService("ReplicatedStorage"):WaitForChild("Rebirths")

local RebirthPads = {
    ["StrengthForRebirth1"] = {
        ["RebirthGain"] = 1,
        ["Cost"] = 100
    },
    ["StrengthForRebirth2"] = {
        ["RebirthGain"] = 2,
        ["Cost"] = 250
    }
}

Rebirths.Event:Connect(function(plr, RebirthPadName)

    if plr.leaderstats.Strength.Value >= RebirthPads[RebirthPadName]["Cost"] then 

        local leaderstats = plr:FindFirstChild("leaderstats")

        plr.leaderstats.Strength.Value = 0
        plr.leaderstats.Rebirths.Value += RebirthPads[RebirthPadName]["RebirthGain"]

    end

end)
#

Look this now looks better

summer dome
#
Rebirths.Event:Connect(function(plr, RebirthPadName)

    if plr.leaderstats.Strength.Value >= RebirthPads[RebirthPadName]["Cost"] then 

        local leaderstats = plr:FindFirstChild("leaderstats")
        local RebirthsMultiplier = leaderstats:FindFirstChild("RebirthsMultiplier")

        plr.leaderstats.Strength.Value = 0
        plr.leaderstats.Rebirths.Value += RebirthPads[RebirthPadName]["RebirthGain"] # im line 54

    end

end)
south robin
#

wait

#

lol

south robin
#

forgot to delete the rebirthmul local

summer dome
#

oh yeah

south robin
#

I'll make the code a bit easier, wait

summer dome
#

same error same line

grizzled crescentBOT
#

studio** You are now Level 9! **studio

summer dome
#

plr.leaderstats.Rebirths.Value += RebirthPads[RebirthPadName]["RebirthGain"]

south robin
#

could u send the leaderstats script where u makes the rebirths value and strength? like all that

summer dome
#

whopps

#

i made mistake

south robin
#

?

summer dome
#

bcs i changed reb gain

#

to rebirths

#

in the table

#

i test now

south robin
#
local Rebirths = game:GetService("ReplicatedStorage"):WaitForChild("Rebirths")

local RebirthPads = {
    ["StrengthForRebirth1"] = {
        ["RebirthGain"] = 1,
        ["Cost"] = 100
    },
    ["StrengthForRebirth2"] = {
        ["RebirthGain"] = 2,
        ["Cost"] = 250
    }
}

Rebirths.Event:Connect(function(plr, RebirthPadName)
    
    local leaderstats = plr:FindFirstChild("leaderstats")
    
    if not leaderstats then return end
    
    local Strength = leaderstats:FindFirstChild("Strength")
    local Rebirths = leaderstats:FindFirstChild("Rebirths")

    if Strength.Value >= RebirthPads[RebirthPadName]["Cost"] then 

        Strength.Value = 0
        Rebirths.Value += RebirthPads[RebirthPadName]["RebirthGain"]

    end

end)
#

Test this if u can

#

This is easier to the eyes

summer dome
#

tysm

#

everything works

#

can you give a rq example of a store script

#

like a buy button

#

script that you can buy a item

#

or smth

south robin
#

Hmm a very easy example of course

summer dome
#

and a if event if a player owns it

#

leave out some parts

#

dont give whole thing

#

i wanna learn myself

south robin
#

in that case you would use a remoteevent to run a serverscript

#

i know, just gonna give the basics

#
local RemoteEvent = game:GetService("ReplicatedStorage"):WaitForChild("NameOfYourEvent")
local Button = script.Parent -- The location of your button

local Cost = 200 -- For example¿?

local Debounce = false -- This is a delay to avoid multiplie runs at once

Button.MouseButton1Click:Connect(function()
    
    if Debounce then return end
    
    Debounce = true
    
    RemoteEvent:FireServer(Cost) -- Here you can send as many arguments as you want, here you sending Cost local to the server
    
    wait(5) -- Delay, in seconds
    
    Debounce = false
    
end)
#

Here you understand easy?

#

is just a very very easy example

#

and now on the server would be a easy example like this

#
local RemoteEvent = game:GetService("ReplicatedStorage"):WaitForChild("NameOfYourEvent")

RemoteEvent.OnServerEvent:Connect(function(plr, Cost)
    
    if plr.leaderstats.Strength.Value >= Cost then
        
        -- And here u use the logic that you want to.
        
    end
    
end)
#

Hope it helps, luck and read all the code i tried to explain it very easy