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

How can i connect the sprint script to the frame?

Well i made a health bar but now i want to make a sprint bar , anybody can help me with the script for it?

wait(1)
function onPlayerEntered(player)
	repeat wait () until player.Character ~= nil
	local s = script.SprintScript:clone()
	s.Parent = player.Character
	s.Disabled = false
	player.CharacterAdded:connect(function (char)
		local s = script.SprintScript:clone()
		s.Parent = char
		s.Disabled = false		
	end)
end

game.Players.PlayerAdded:connect(onPlayerEntered)

So i don't know how to connect the script to the Sprint GUI frame overlay...

1 answer

This is completely unnecessary. You do not need to make a script that gives every player a script. Yu simply put it is StarterCharacterScripts This handy instance will clone every child it has and place it either in the Player or the Character depending on which one you put it in.

Simply place your script in game.StarterPlayer.StarterCharacterScripts and it should work fine.

Read more about it here.

1 comment

0

Although this was nice optimisation, this was not the answer. I recommend you at least tell him early on in the answer if you are only giving an optimisation.

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