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

Attempt Ver: [V0.4] LocalScript isn't running + no errors, Please help! Have Links [?]

Notes:

  1. This is a local script inside A text label inside guis
  1. NO Filtering Enabled
local BattleFrame = script.Parent.Parent:WaitForChild('BattleFrame')
local IntroText = script.Parent
local W = 0.07
local BlurEffect = game.Lighting:WaitForChild('Blur')
local AOP = game.ReplicatedStorage:WaitForChild('AmountOfPlayers')



game.Players.PlayerAdded:Connect(function()
	wait()
	if game.Players.NumPlayers == 1 then
		BlurEffect.Size = 24
		IntroText.Visible = true
		wait(2)
		IntroText.Text = 'Need one more player!'
		wait(5)
		IntroText.Text = 'Loading.'
		wait(1)
		IntroText.Text = 'Loading..'
		wait(1)
		IntroText.Text = 'Loading...'
		wait(2)
		IntroText.Text = 'Need one more player!'
		wait(5)
		IntroText.Text = 'Waiting...'
		game.Players.NumPlayers.Changed:Connect(function()
			if AOP.Value == 2 then
				wait(3)
				IntroText.Text = 'Ready?'
				wait(3)
				IntroText.Text = 'Set?'
				wait(3)
				IntroText.Text = 'FIGHT!'
				wait(3)
				IntroText.Visible = false
				BlurEffect.Size = 0
				wait(W)
				BattleFrame.Visible = true
			end
		end)
	end
end)

[PROBLEM]; When joining the game, nothing runs. No blue, no text label, no nothing. So I need to know why this isn't running and how to fix it.

If you wanna try yourself;

NOTE

  1. When you join, there's suppose to be a blue with a text label in the center saying "Loading". But nothing happens

https://web.roblox.com/games/975537457/Red-V-S-Blue-Tower-Defense-BETA-TESTING

1 comment

0

Put that in a link thing.

1 answer

✓ Accepted answer

You have two player variables, you would not need the function. A playeradded function is only recommended for server scripts.

Instead of that function, try this function:

plr.PlayerAdded:connect(function()

end)

Unless you use a server script, you would need to use the PlayerAdded event from the service Players since server scripts cannot access LocalPlayer.

If my answer helped you, please don't forget to accept it!

_____________________________

EDIT: Instead of having a value that checks for the amount of players available, use the service Players instead as it has a property that can read the amount of players in the server.

14 comments

0

I'm sorry to ask but, can you rewrite the code that is fixed? I don't understand what to add and remove. If you can't do that, that's find as well. Thanks! I will wait for a reply

0

I made a mistake, I accidentally added the localplayer variable somehow, try again, I re-edited it.

0

Aww so you won't re-write the script for me? ok ;~;

0

btw: PlayerAdded is not a valid member of Player

0

change plr to game:GetService("Players")

0

god dammit i keep making mistakes am i having brain farts all over the place

0

I edited my script, take a look at my question's script again i will show you now, it still doesn't work.

0

Doesn't work. Please help me fix.

0

SMH DUDE I SAID USE .NumPlayers for PLAYERS not the AOP VALUE

0

I don't know how. Please ;-;. it would help so much if you did cause I don't know properties of Player. Please re-write code

0

I have been looking at other question and I know your answers are beautifully written and nicely organized but I really need help ;-;

0

uhh its instead of AOP.Value it would be game.Players.NumPlayers

0

I wish you could just write entire code again with the fixed parts

0

And it doesn't work

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