I’m making a game where you collect cups and when you click the cups they give you a randomized special ability. However, the tool.Activated() is seeming to either not work, or the tool isn’t clickable at all? The tool is in replicatedstorage (it gets cloned to the workspace, and then the player can pick it up). I set “RequiresHandle to false” and ManualActivationOnly is disabled. I tried using a local script and it still didnt work. I cant find what is the problem??
Tool main server code:
--//Services
local STORAGE = game:GetService("ServerStorage")
local SS = game:GetService("SoundService")
local DEBRIS = game:GetService("Debris")
local SSS = game:GetService("ServerScriptService")
local RS = game:GetService("ReplicatedStorage")
--//Variables
local handle = script.Parent
local tool = handle.Parent
local use_sound = handle:WaitForChild("Use")
local vfx = STORAGE:WaitForChild("PARTICLES").OIL_PARTICLE.Middle
local player = game.Players.PlayerAdded:Wait()
local module = require(SSS:WaitForChild("BACK_END").MODULES.RANDOMIZE_CUP)
local eye_eater = RS:WaitForChild("Trolls").OIl["eye eater"]
local garlic = RS:WaitForChild("Trolls").OIl["Garlic troll"]
function main(player)
use_sound:Play()
local vfx_clone = vfx:Clone()
vfx_clone.Parent = handle
for _, vfx in vfx_clone:GetChildren() do
vfx:Emit()
end
DEBRIS:AddItem(vfx_clone, 2)
local selected = module:randomize(0.99, 0.01, nil, nil, eye_eater, garlic)
if (selected) then
print(selected)
end
end
--//Connecting
tool.Activated:Connect(main)
Randomization module code:
local random_module = {}
function random_module:randomize(chance_1, chance_2, chance_3, chance_4, selected_1, selected_2, selected_3, selected_4)
local rng = math.random()
if (rng <= chance_1) then
return selected_1
end
if (rng <= chance_1 + chance_2) then
return selected_2
end
if (rng <= chance_1 + chance_2 + chance_3) then
return selected_3
end
if (rng <= chance_1 + chance_2 + chance_3 + chance_4) then
return selected_4
end
return nil
end
return random_module
Any help is appreciated ![]()