You would want to make a List/Table of all the parts of a humanoid you want to be affected, and then use a math.random function to choose a random one and then apply it to their character.
Something like this.
local humProps = {"JumpPower","Health","WalkSpeed"}
local JumpPowerChange = 25
local HealthChange = 100
local WalkSpeedChange = 15
local function eatApple()
math.randomseed(tick())
local randomHumProp = humProps[math.random(1,#humProps)]
local playerChar = script.Parent.Parent
script.Parent.Handle.EatSound:Play()
local player = game:GetService("Players"):FindFirstChild(playerChar.Name)
local character = player.Character or player.CharacterAdded:Wait()
local hum = character:FindFirstChild("Humanoid")
if randomHumProp == "JumpPower" then
hum.JumpPower = hum.JumpPower + JumpPowerChange
elseif randomHumProp == "Health" then
hum.MaxHealth = hum.MaxHealth + HealthChange
wait(0.1)
hum.Health = hum.Health + HealthChange
elseif randomHumProp == "WalkSpeed" then
hum.WalkSpeed = hum.WalkSpeed + WalkSpeedChange
end
wait(1.4)
script.Parent:Destroy()
end
script.Parent.Activated:Connect(eatApple)
This will always randomize which one will be applied, and feel free to add more to the list and be creative!
6 comments
Also, the player's name doesn't have a child, humanoid.
It does though, because the tool is inside of the character, and that references the humanoid inside of the character holding the tool.
oh
I really don't know which one to choose ... everyone helped me
Choose which ever one helped you the most
LukaRoblox100 was trying to help you learn, instead of hurting you by giving the answer. I gave the answer but added comments and simplicity so you could understand. Killerbrenden gave you an advanced script but didn't really explain it.