TZH on Nostr: local currencyMultiplier = 2 -- Replace with your desired multiplier local areaPart = ...
local currencyMultiplier = 2 -- Replace with your desired multiplier
local areaPart = game.Workspace.MultiplierArea -- Replace with the name of your "Part"
local playersInside = {} -- Keep track of players inside the area
-- Function to apply the currency multiplier to a player
local function applyMultiplier(player)
-- Replace with your currency system code
-- Example: player.leaderstats.Currency.Value = player.leaderstats.Currency.Value * currencyMultiplier
end
-- Function to remove the currency multiplier from a player
local function removeMultiplier(player)
-- Replace with your currency system code
-- Example: player.leaderstats.Currency.Value = player.leaderstats.Currency.Value / currencyMultiplier
end
-- Function to check if a player is alive
local function isPlayerAlive(player)
local humanoid = player.Character and player.Character:FindFirstChild("Humanoid")
return humanoid and humanoid.Health > 0
end
-- Detect when a player enters or leaves the area
areaPart.Touched:Connect(function(part)
local player = game.Players:GetPlayerFromCharacter(part.Parent)
if player and isPlayerAlive(player) then
if not playersInside[player] then
playersInside[player] = true
applyMultiplier(player)
end
end
end)
areaPart.TouchEnded:Connect(function(part)
local player = game.Players:GetPlayerFromCharacter(part.Parent)
if player and playersInside[player] then
playersInside[player] = nil
removeMultiplier(player)
end
end)
Published at
2023-02-14 07:27:32Event JSON
{
"id": "a70f52d9eee9bc6a18a690cfbde677cec8ad2521f66e861df40737bdeaa91ae4",
"pubkey": "cc7a67745452c600257b3214c78d559d5ef671a9b274827c4bd9ebd7538b8f51",
"created_at": 1676359652,
"kind": 1,
"tags": [],
"content": "local currencyMultiplier = 2 -- Replace with your desired multiplier\nlocal areaPart = game.Workspace.MultiplierArea -- Replace with the name of your \"Part\"\nlocal playersInside = {} -- Keep track of players inside the area\n\n-- Function to apply the currency multiplier to a player\nlocal function applyMultiplier(player)\n -- Replace with your currency system code\n -- Example: player.leaderstats.Currency.Value = player.leaderstats.Currency.Value * currencyMultiplier\nend\n\n-- Function to remove the currency multiplier from a player\nlocal function removeMultiplier(player)\n -- Replace with your currency system code\n -- Example: player.leaderstats.Currency.Value = player.leaderstats.Currency.Value / currencyMultiplier\nend\n\n-- Function to check if a player is alive\nlocal function isPlayerAlive(player)\n local humanoid = player.Character and player.Character:FindFirstChild(\"Humanoid\")\n return humanoid and humanoid.Health \u003e 0\nend\n\n-- Detect when a player enters or leaves the area\nareaPart.Touched:Connect(function(part)\n local player = game.Players:GetPlayerFromCharacter(part.Parent)\n if player and isPlayerAlive(player) then\n if not playersInside[player] then\n playersInside[player] = true\n applyMultiplier(player)\n end\n end\nend)\n\nareaPart.TouchEnded:Connect(function(part)\n local player = game.Players:GetPlayerFromCharacter(part.Parent)\n if player and playersInside[player] then\n playersInside[player] = nil\n removeMultiplier(player)\n end\nend)",
"sig": "7ed58536f27d2cb959c1f08cd11e7c7dd5ce29fed9182a5d03564b3c88d1b77bd329b93385ed0fdd97614cb52dfd8ef054227e7461ae49416bce9f91d9b670ae"
}