Local:
local Tool = script.Parent
local DrinkSound = script.Parent:WaitForChild("DrinkSound")
local db = false
local AddEffect = game.ReplicatedStorage.RemoteEvents:WaitForChild("MysteriousPotionAddEffect")
local Contents = script.Parent:WaitForChild("Contents")
local Effects = {
["SpeedBoost"] = 70;
["JumpBoost"] = 70;
["Heal Player"] = 35;
["LowerGravity"] = 12;
["Damage Player"] = 5;
}
local function ChooseEffect()
local Sum = 0
for effect, chance in pairs(Effects) do
Sum += chance
end
local RandomNum = math.random(Sum)
for effect, chance in pairs(Effects) do
if RandomNum <= chance then
return effect
else
RandomNum -= chance
end
end
end
Tool.Activated:Connect(function()
if db == false then
local ChosenEffect = ChooseEffect
AddEffect:FireServer(ChosenEffect)
end
end)
local t = 3
while wait(0.03) do
local hue = tick() % t / t
local color = Color3.fromHSV(hue,1,1)
Contents.Color = color
end
Server:
-- This script handles gadget purchases and gadgets effects
local AddEffect = game.ReplicatedStorage.RemoteEvents:WaitForChild("MysteriousPotionAddEffect")
local EffectsDetails = {
["SpeedBoost"] = {0.35,20}; -- Amount in %, Duration
["JumpBoost"] = {0.35,20};
["Heal Player"] = {0.35};
["LowerGravity"] = {0.7,20};
["Damage Player"] = {0.15};
}
local Animation = script:WaitForChild("MysteriousPotionAnimation")
AddEffect.OnServerEvent:Connect(function(player, ChosenEffect)
print(ChosenEffect)
local Char = player.Character
local Hum = Char:WaitForChild("Humanoid")
local AnimationToPlay = Hum:LoadAnimation(Animation)
AnimationToPlay:Play()
if ChosenEffect == "SpeedBoost" then
Hum.WalkSpeed += math.floor(Hum.WalkSpeed * EffectsDetails.SpeedBoost[1])
wait(EffectsDetails.SpeedBoost[2])
Hum.WalkSpeed = 16
end
end)