Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why wont this work? - Functions ect -

--(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

✓ Accepted answer
function BH()
y = game.ReplicatedStorage["GUI_DRIVE"].YABHGUI:Clone()
y.Parent = game.Players.LocalPlayer.PlayerGui
wait(3)
y:remove()
end

This should work.

This discussion is preserved as it was. New answers, comments, and votes are closed.