I'm trying to create a tool that when you click with it in your hand has a 50/50 chance to give you 2 types of effects when I tested to see if this script would work I saw it had no errors but even when clicking it did nothing. Here is my script.
local tool = script.Parent local h = game.Players.LocalPlayer.Character.Humanoid local RandomNumber = math.random(1,2)
tool.Activated:Connect(function() if RandomNumber == 1 then h.MaxHealth = h.MaxHealth + 50 h.Health = h.Health + 50 end if RandomNumber == 2 then game.StarterGui.Blind.Enabled = true if h.Health == 0 then game.StarterGui.Blind.Enabled = false end end end)
Seems you almost got the hang of it.
local Tool = script.Parent local Players = game:GetService('Players') Tool.Activated:Connect(function() local Player = Players:GetPlayerFromCharacter(Tool.Parent) local randomNumber = math.random(1,2) -- number between 1 and 2 if Player.Character then if randomNumber == 1 then -- do stuff elseif randomNumber == 2 then -- do other stuff end -- number check end -- character check end) -- onActivated