hello, its me again
i made a badge called “Beat the Tower of Neil Cicierega” and i wanna make the player in the leaderboard get a tower count for getting that badge.
i have the script but, where do i put it or stuff to get it to work?
badge:
the tower count is in the leaderboard and if u get a tower completion badge, you obtain 1 tower count
i have a intvalue for the badge id and i put the id in.
made a folder with badges with a simple script inside (module script just doing return badges and stuff)
as everything works, the tower count doesnt go from 0 to 1 once obtaining the badge
Definitely not knowing what JToH is I think you could just use a simple Touched Event to check if the Part that got touched is a parent of the Player’s Character using the GetPlayerFromCharacter() function
You’d also need to use BadgeService's AwardBadge function to properly award the badge to the player
local BadgeService = game:GetService("BadgeService")
local TowerBadgeID = 000000000 --Placeholder, replace this with your ID
--local WinnerPosition = workspace.WinnerPlace.Position --Supposedly you can use a Vector3 Value if you want to teleport the Character to the winner area, remove the 2 lines if you want that
local Part = script.Parent --This would be your winner teleporter part or whatever
local DB = false --This is to prevent the script from firing multiple times when triggering the Event
local function TeleportAndReward(Hit)
local PlayerCheck = game.Players:GetPlayerFromCharacter(Hit.Parent)
if not DB and PlayerCheck then --This would check if the Hit's Parent is equal to a Player's Character Model, and that our DB is not being abused
DB = true
local Character = Hit.Parent
PlayerCheck.leaderstats.TowerCount.Value += 1 --Adding 1 more value to our completed Towers
BadgeService:AwardBadge(PlayerCheck.UserId, TowerBadgeID)
wait(3)
DB = false --Setting our DB back to fire again
--Character.HumanoidRootPart.Position = WinnerPosition
end
end
Part.Touched:Connect(TeleportAndReward)
JToH is a popular parkour game that is a hardcore game with alot of scripts. As i have most of the scripts done, the badge just is a piece of the script jtoh has, jtoh having 200 badges.
uh, something doesnt work and i have no errors in output
First of all, you should learn the basics of programming Lua, so you have little experience with Lua.
Are you sure you’re referencing & changing everything correctly? The script would only reward the Badge if you reference the Badge’s ID
i did reference the badge id, the badge gets collected but… my tower count stays at 0
i changed winnerplace or whatever your name was to WinPad, which is my part name (i did put the – away to get the thing to teleport to the winroom thing)
Where exactly are you making this TowerCount Object Value? I mean it should work just fine if you’re referencing the name properly
I see no reason why it shouldn’t work, usually debugging with print statements help the issue
well, every tower is inside a folder to be referenced to make it organized, there are no output errors, and those folders usually include a IntValue called “BadgeID”. as the name implies, i put it there, and in the script.
folders of towers include the obby, the clientobjects, a badgeID intvalue, frame modeled. ignore the first 2 and last thing, the intvalue matters.
