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

Why wont this work? - Functions ect -

Asked by
iLegitus 130
9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.
--(iLegimate)--

function CBH()
local players = game.Players:GetPlayers()
local randomPlayer = players[math.random( 1, #players ) ]
randomPlayer.Character.Humanoid.MaxHealth = 2000
wait()
randomPlayer.Character.Humanoid.Health = 2000
if randomPlayer.PlayerGui:findFirstChild("YABHGUI") then
    randomPlayer.PlayerGui.YABHGUI:remove()
end
    yg = game.ReplicatedStorage["GUI_DRIVE"].YGABGUI:Clone()
    yg.Parent = randomPlayer.PlayerGui
    wait(3)
    yg:remove()

if randomPlayer.Character:findFirstChild("Shirt") then
    randomPlayer.Character.Shirt:remove()
    wait()
    s = Instance.new("Shirt", randomPlayer.Character)
    s.Name = "Shirt"
    s.ShirtTemplate = "http://www.roblox.com/asset/?id=164926016"
else
    s = Instance.new("Shirt", randomPlayer.Character)
    s.Name = "Shirt"
    s.ShirtTemplate = "http://www.roblox.com/asset/?id=164926016"
end

if randomPlayer.Character:findFirstChild("Pants") then
    randomPlayer.Character.Pants:remove()
    p = Instance.new("Pants", randomPlayer.Character)
    p.Name = "Pants"
    p.PantsTemplate = "http://www.roblox.com/asset/?id=164334324"
else
    p = Instance.new("Pants", randomPlayer.Character)
    p.Name = "Pants"
    p.PantsTemplate = "http://www.roblox.com/asset/?id=164334324"

end
-- ADD WHEN THE PLAYER GETS TELEPORTED! --
M9 = game.ReplicatedStorage["TOOL_DRIVE"].M92FS:Clone()
M9.Parent = randomPlayer.Backpack
end

function BH()
    for i,v in pairs(Game.Players:GetPlayers()) do 
    pcall(function() 
    M9 = game.ReplicatedStorage["TOOL_DRIVE"].M92FS:Clone()
    M9.Parent = v.Backpack
    end) 
    y = game.ReplicatedStorage["GUI_DRIVE"].YABHGUI:Clone()
    y.Parent = v.PlayerGui
    wait(3)
    y:remove()
    -- ADD WHEN THE PLAYERS GET TELEPORTED! --
    end
end

while true do 
    if game.Players.NumPlayers > 1 then
    wait(24.5)
    CBH()
    BH()

    end
end

Whats wrong is that the gui's that i want loaded arent being cloned from replicated storage,Into the player's guis. I "Think",Anyone know the error?

2 answers

Log in to vote
-2
Answered by 9 years ago
function BH()
y = game.ReplicatedStorage["GUI_DRIVE"].YABHGUI:Clone()
y.Parent = game.Players.LocalPlayer.PlayerGui
wait(3)
y:remove()
end

This should work.

Ad
Log in to vote
0
Answered by 9 years ago

Any output?

0
No,For some odd reason iLegitus 130 — 9y

Answer this question