Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why dosent this work?

Asked by 10 years ago

Im making a horror game and this is the script to pick someone random from Players But it dosent work can you help me?

Heres the script:

local Player = game.Players:GetPlayers()

local Formof = script.Parent
local Weapon = Game.ReplicatedStorage:FindFirstChild('Knife')
Weapon.Parent = Player.BackPack
Chance = Players[math.randomseed(#players)]


if Player == script.Parent then
    script.Parent.Health = 2000
    script.Parent.Walkspeed = 52
    script.Parent.MaxHealth = 2000
end


1 answer

Log in to vote
0
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
10 years ago

I didn't do this, but I'd recommend putting in a while true do loop with each variable within the loop so every minute or so, a new person would be picked. Here's your script fixed up.

local Player = game.Players:GetPlayers()

local Formof = script.Parent
local Weapon = Game.ReplicatedStorage:FindFirstChild('Knife')
Chance = Player[math.random(1, #Player)]
SelectedPlayerName = Chance.Name



if Chance then
    Chance.Character.Humanoid.Health = 2000
   Chance.Character.Humanoid.Walkspeed = 52
    Chance.Character.Humanoid.MaxHealth = 2000
    Weapon:clone().Parent = Chance.Backpack
end

I'm not sure what you're trying to do with the Health, but could you comment what you're trying to do?

0
Im trying to do this if the player is the killer then the health would be 2000 digitalzer3 123 — 10y
0
Try now Shawnyg 4330 — 10y
0
Ok digitalzer3 123 — 10y
Ad

Answer this question