Sure! Here's the complete updated script for your SpicyTool, incorporating the new gamepass with ID 949307122. This gamepass functions similarly to your existing double SHU gamepass (909091586). If a player owns only one of these gamepasses, their SHU per click will be doubled. If they own both, their SHU per click will be quadrupled.
Updated SpicyTool Script
-- Path: SpicyTool (Local Script)
local tool = script.Parent
local handle = tool:WaitForChild("Handle", 1)
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local SoundService = game:GetService("SoundService")
-- GUI elements
local playerGui = player:WaitForChild("PlayerGui")
local overheatGui = playerGui:WaitForChild("OverheatGui")
local heatFrame = overheatGui:WaitForChild("HeatFrame")
local currentHeat = heatFrame:WaitForChild("CurrentHeat")
local overheatValue = currentHeat:WaitForChild("Overheat")
local overheatFrame = overheatGui:WaitForChild("Overheat")
local shuPerClickGui = playerGui:WaitForChild("SHUPerClick")
local shuPerClickLabel = shuPerClickGui:WaitForChild("TextLabel")
tool:SetAttribute("BaseSHU", 1) -- Set this for base SHU
-- Constants
local CLICKS_TO_OVERHEAT = 15
local BASE_COOLDOWN_TIME = 1
local OVERHEAT_DURATION = 5
local REFILL_DURATION = 0.5
local OVERHEAT_REDUCTION_INTERVAL = 0.5
local OVERHEAT_REDUCTION_AMOUNT = 0.1
local ANIMATION_ID = "rbxassetid://99183644765532"
local LABEL_DISPLAY_TIME = 1
local DOUBLE_SPEED_GAMEPASS_ID = 909100554
local DOUBLE_SHU_GAMEPASS_ID = 909091586 -- Existing gamepass ID for double SHU
local DOUBLE_SHU_GAMEPASS_ID2 = 949307122 -- New gamepass ID for additional double SHU
-- Suffix table for number formatting
local suffixTable = {
"K", -- Thousand
"M", -- Million
"B", -- Billion
"T", -- Trillion
"Qa", -- Quadrillion
"Qi",
"Sx",
"Sp",
"Oc",
"No",
"Dc",
"Ud",
"Dd",
"Td",
"Qad",
"Qid",
"Sxd",
"Spd",
"Ocd",
"Nod",
"Vg",
"UVg",
"DVg",
"TVg",
"QaVg",
"QiVg",
"SxVg",
"SpVg",
"OcVg",
"NoVg",
"Tg",
"UTg",
"DTg",
"TTg",
"QaTg",
"QiTg",
"SxTg",
"SpTg",
"OcTg",
"NoTg",
"Qag",
"Uqg",
"Dqg",
"Tqg",
"Qaqg",
"Qiqg",
"Sxqg",
"Spqg",
"Ocqg",
"Noqg",
"Qng",
"Uqng",
"Dqng",
"Tqng",
"Qaqng",
"Qiqng",
"Sxqng",
"Spqng",
"Ocqng",
"Noqng",
"Sxg",
"Usxg",
"Dsxg",
"Tsxg",
"Qasxg",
"Qisxg",
"Sxsxg",
"SpSxg",
"OcSxg",
"NoSxg",
"Spg",
"Uspg",
"Dspg",
"Tspg",
"Qaspg",
"Qispg",
"Sxspg",
"Spspg",
"Ocspg",
"NoSpg",
"Ocg",
"Uocg",
"Docg",
"Tocg",
"Qaocg",
"Qiocg",
"Sxocg",
"Spocg",
"OcOCg",
"NoOcg",
"Nog",
"Unog",
"Dnog",
"Tnog",
"Qanog",
"Qinog",
"Sxnog",
"Spnog",
"Ocnog",
"NoNog",
"C",
}
-- Function to format large numbers with suffixes
local function formatNumber(number)
local index = 0
while number >= 1000 and index < #suffixTable do
number = number / 1000
index = index + 1
end
if index == 0 then
return tostring(math.floor(number))
else
return string.format("%.1f%s", number, suffixTable[index])
end
end
-- Variables
local clickCount = 0
local lastClickTime = 0
local isOverheating = false
local currentSHUPerClick = 1
local hasDoubleSpeedGamepass = false
local hasDoubleSHUGamepass = false
local hasDoubleSHUGamepass2 = false -- Variable for the new gamepass
-- Services
local tweenService = game:GetService("TweenService")
local replicatedStorage = game:GetService("ReplicatedStorage")
local marketplaceService = game:GetService("MarketplaceService")
-- Check if the player owns the gamepasses
local function checkGamepasses()
-- Check for the first double SHU gamepass
local success, hasSHUPass = pcall(function()
return marketplaceService:UserOwnsGamePassAsync(player.UserId, DOUBLE_SHU_GAMEPASS_ID)
end)
if success then
hasDoubleSHUGamepass = hasSHUPass
else
warn("Failed to check double SHU gamepass ownership:", hasSHUPass)
end
-- Check for the second double SHU gamepass
local success2, hasSHUPass2 = pcall(function()
return marketplaceService:UserOwnsGamePassAsync(player.UserId, DOUBLE_SHU_GAMEPASS_ID2)
end)
if success2 then
hasDoubleSHUGamepass2 = hasSHUPass2
else
warn("Failed to check second double SHU gamepass ownership:", hasSHUPass2)
end
-- Check for the double speed gamepass
local successSpeed, hasSpeedPass = pcall(function()
return marketplaceService:UserOwnsGamePassAsync(player.UserId, DOUBLE_SPEED_GAMEPASS_ID)
end)
if successSpeed then
hasDoubleSpeedGamepass = hasSpeedPass
else
warn("Failed to check double speed gamepass ownership:", hasSpeedPass)
end
end
-- Call this function when the script loads
checkGamepasses()
-- Function to get the current cooldown time
local function getCurrentCooldownTime()
return hasDoubleSpeedGamepass and BASE_COOLDOWN_TIME / 2 or BASE_COOLDOWN_TIME
end
-- Create or get the RemoteEvents
local updateSHUEvent = replicatedStorage:FindFirstChild("UpdateSHUEvent")
local updatePetBonusEvent = replicatedStorage:FindFirstChild("UpdatePetBonusEvent")
local toolSwitchEvent = replicatedStorage:FindFirstChild("ToolSwitchEvent")
-- Load the animation
local animationInstance = Instance.new("Animation")
animationInstance.AnimationId = ANIMATION_ID
local animationTrack = humanoid:LoadAnimation(animationInstance)
-- Function to update SHU per click based on gamepasses and pet bonuses
local function updateSHUPerClick(petBonus, petMultiplier, toolBaseSHU)
local BASE_SHU_PER_CLICK = toolBaseSHU or tool:GetAttribute("BaseSHU") or 1
petBonus = petBonus or 0
petMultiplier = petMultiplier or 1
-- Calculate total SHU multiplier from gamepasses
local SHU_MULTIPLIER = 1
if hasDoubleSHUGamepass then
SHU_MULTIPLIER = SHU_MULTIPLIER * 2
end
if hasDoubleSHUGamepass2 then
SHU_MULTIPLIER = SHU_MULTIPLIER * 2
end
-- Apply multiplier to (base SHU + bonus)
currentSHUPerClick = (BASE_SHU_PER_CLICK + petBonus) * petMultiplier * SHU_MULTIPLIER
-- Update the GUI to show the new SHU per click with formatted number
shuPerClickLabel.Text = string.format("+%s🌶️", formatNumber(currentSHUPerClick))
end
-- Function to show scattered SHU gained with improved animations
local function showScatteredSHUGained()
-- Clone the template label
local scatterLabel = shuPerClickLabel:Clone()
scatterLabel.Parent = shuPerClickGui
-- Get or create the UIStroke
local uiStroke = scatterLabel:FindFirstChild("UIStroke")
if not uiStroke then
uiStroke = Instance.new("UIStroke")
uiStroke.Parent = scatterLabel
end
scatterLabel.Text = string.format("+%s🌶️", formatNumber(currentSHUPerClick))
local screenSize = workspace.CurrentCamera.ViewportSize
-- Set initial properties
scatterLabel.Size = UDim2.new(0.05, 0, 0.03, 0) -- Start smaller
scatterLabel.TextTransparency = 0.1 -- Start slightly transparent
uiStroke.Transparency = 0.1
-- Calculate random position with some padding
local padding = 100
local randomX = math.random(padding, screenSize.X - padding)
local randomY = math.random(padding, screenSize.Y - padding)
scatterLabel.Position = UDim2.new(0, randomX, 0, randomY)
scatterLabel.Visible = true
-- Create combined animation sequence
local animationInfo = TweenInfo.new(
LABEL_DISPLAY_TIME,
Enum.EasingStyle.Quad,
Enum.EasingDirection.Out,
0, -- RepeatCount
false, -- Reverses
0 -- DelayTime
)
-- Create growing and floating animation
local growAndFloat = tweenService:Create(
scatterLabel,
animationInfo,
{
Size = UDim2.new(0.12, 0, 0.1, 0), -- End larger
Position = UDim2.new(0, randomX, 0, randomY - 50), -- Float upward
TextTransparency = 1
}
)
-- Create stroke fade animation
local strokeFade = tweenService:Create(
uiStroke,
animationInfo,
{
Transparency = 1
}
)
-- Play animations
growAndFloat:Play()
strokeFade:Play()
-- Cleanup after animation
growAndFloat.Completed:Connect(function()
scatterLabel:Destroy()
end)
end
-- Function to update heat display
local function updateHeatDisplay()
local heatPercent = math.min(clickCount / CLICKS_TO_OVERHEAT, 1)
tweenService:Create(currentHeat, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out),
{Size = UDim2.new(heatPercent, 0, currentHeat.Size.Y.Scale, 0)}):Play()
end
-- Function to update overheat state display
local function updateOverheatDisplay()
overheatFrame.Visible = isOverheating
end
-- Function to handle tool activation
local function onActivated()
local currentTime = tick()
local currentCooldownTime = getCurrentCooldownTime()
if currentTime - lastClickTime < (isOverheating and currentCooldownTime/2 or currentCooldownTime) then
return
end
lastClickTime = currentTime
local success, errorMsg = pcall(function()
animationTrack:Play()
end)
if not success then
warn("Failed to play animation: " .. tostring(errorMsg))
end
updateSHUEvent:FireServer(currentSHUPerClick)
local eatSound = SoundService:FindFirstChild("Eat")
if eatSound and eatSound:IsA("Sound") then
eatSound:Play()
else
warn("Eat sound not found or is not a Sound instance.")
end
showScatteredSHUGained()
if not isOverheating then
clickCount = clickCount + 1
updateHeatDisplay()
if clickCount >= CLICKS_TO_OVERHEAT then
overheatValue.Value = true
isOverheating = true
updateOverheatDisplay()
spawn(function()
local overheatStartTime = tick()
while tick() - overheatStartTime < OVERHEAT_DURATION do
wait(OVERHEAT_REDUCTION_INTERVAL)
clickCount = math.max(0, clickCount - CLICKS_TO_OVERHEAT * OVERHEAT_REDUCTION_AMOUNT)
updateHeatDisplay()
end
overheatValue.Value = false
isOverheating = false
updateOverheatDisplay()
clickCount = 0
updateHeatDisplay()
end)
end
end
end
-- Connect tool activation to the function
tool.Activated:Connect(onActivated)
-- Function to handle equipping and unequipping
local function onEquipped()
-- Get the base SHU for this tool
local toolBaseSHU = tool:GetAttribute("BaseSHU") or 1
-- Trigger an update on the server
toolSwitchEvent:FireServer(toolBaseSHU)
end
local function onUnequipped()
-- Do nothing when unequipped
end
tool.Equipped:Connect(onEquipped)
tool.Unequipped:Connect(onUnequipped)
-- Connect to the UpdatePetBonusEvent to receive updates about equipped pets
updatePetBonusEvent.OnClientEvent:Connect(function(petBonus, petMultiplier, toolBaseSHU)
updateSHUPerClick(petBonus, petMultiplier, toolBaseSHU)
end)
Explanation of the Changes
-
Added New Gamepass ID:
local DOUBLE_SHU_GAMEPASS_ID2 = 949307122 -- New gamepass ID for additional double SHU
This line introduces the new gamepass ID that will provide another x2 SHU multiplier.
-
New Variable to Track Ownership:
local hasDoubleSHUGamepass2 = false -- Variable for the new gamepass
This variable keeps track of whether the player owns the new gamepass.
-
Updated checkGamepasses Function:
-- Check for the second double SHU gamepass
local success2, hasSHUPass2 = pcall(function()
return marketplaceService:UserOwnsGamePassAsync(player.UserId, DOUBLE_SHU_GAMEPASS_ID2)
end)
if success2 then
hasDoubleSHUGamepass2 = hasSHUPass2
else
warn("Failed to check second double SHU gamepass ownership:", hasSHUPass2)
end
This segment checks if the player owns the new gamepass and updates the corresponding variable.
-
Modified updateSHUPerClick Function:
-- Calculate total SHU multiplier from gamepasses
local SHU_MULTIPLIER = 1
if hasDoubleSHUGamepass then
SHU_MULTIPLIER = SHU_MULTIPLIER * 2
end
if hasDoubleSHUGamepass2 then
SHU_MULTIPLIER = SHU_MULTIPLIER * 2
end
-- Apply multiplier to (base SHU + bonus)
currentSHUPerClick = (BASE_SHU_PER_CLICK + petBonus) * petMultiplier * SHU_MULTIPLIER
This modification ensures that each owned gamepass doubles the currentSHUPerClick. If a player owns both gamepasses, the SHU per click becomes quadrupled.
-
Additional Safeguards:
How It Works
Testing the Changes
To ensure everything works as expected:
-
Gamepasses Ownership:
- Test with no gamepasses owned to confirm SHU per click remains at the base value.
- Test with only one of the double SHU gamepasses owned to confirm SHU per click is doubled.
- Test with both gamepasses owned to confirm SHU per click is quadrupled.
-
SHU Display:
- Verify that the SHU per click is correctly formatted and displayed in the GUI.
- Ensure that floating SHU gains appear with the correct values based on owned gamepasses.
-
Overheat Mechanic:
- Rapidly click to trigger the overheating state and observe the cooldown behavior.
-
Animations and Sounds:
- Ensure that animations play smoothly and sounds are audible upon activation.
By following these steps and integrating the above script, your SpicyTool should now support the additional gamepass, enhancing the SHU per click based on the player's purchases.