#rebirths
160 messages · Page 1 of 1 (latest)
Touched are only part func
idk whats your intention
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)
alright, and they have names like rebirth2 and rebirth1?
they fire the same event no?
they same event
alright, then let me a moment show u a very easy fix with a table
Did you just sensor your player name?
Change plr.Touched == rebirth2 to, rebirth2.touched:Connect(function(plr))
The touched event should be used on the part not the player
that would be inneficient doing a func for every part
I haven’t seen the full script so idk what he’s trying to do but you can’t do plr.touched lol
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
Yh
im just waiting for him to send the script
its the same as the last post
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)
well, is deleted
yeah
alright, then lemme do a quick thing and explain how to add more pads if you want to
This script would be:
oh
wait
Same script lol
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
Should work
** You are now Level 1! **
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
yes, table are like god
how r u so good!
it works
i need to learn more
😦
niceee, this is like automatic, you just need to add like my explanation
dw!, this takes time, but times will give you the reward
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)
u want to hide the rebirthmultiplier ?
i dont want rebmulti to show
you know
yeah
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.
k
^
and the one above
k
Could use a intvalue if you don’t want it to show
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
Yh
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
nice, with that u only need rebirth value
** You are now Level 9! **
u edited this?
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)
just my typing lol messed up
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
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)
look again
forgot to delete the rebirthmul local
oh yeah
I'll make the code a bit easier, wait
same error same line
** You are now Level 9! **
plr.leaderstats.Rebirths.Value += RebirthPads[RebirthPadName]["RebirthGain"]
could u send the leaderstats script where u makes the rebirths value and strength? like all that
?
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
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
Hmm a very easy example of course
and a if event if a player owns it
leave out some parts
dont give whole thing
i wanna learn myself
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