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

Server Script does not receive :FireServer?

Hey there. I am currently trying to make LocalScript and ServerScript communicate with each other. Now, this Script worked before, made no changes on it and so on. (Just advnaced the script, but nothing has to do with the problem)

It should print ("Worked!"), but it doesnt. Even tho the :FireServer worked.

LocalScript:

game.Players.LocalPlayer.PlayerGui.Dialog.Frame.Text.Text = "Lets go!"
wait(2)
print("Firing Server")  --prints
game.ReplicatedStorage.Dialogg18:FireServer()
print("Fired Server")  --prints
end

And the ServerScript:

local function Func()
print("Got Event")
local isnil
local NumberD2 = 0
local NewNameF
local NewNameP
local UserCountIdk = workspace.AllPlayer:GetChildren()
for i, user in ipairs(UserCountIdk) do
	repeat
		NumberD2 = NumberD2 + 1
		NewNameF = "User" .. NumberD2
		NewNameP = workspace.AllPlayer:FindFirstChild(NewNameF).Value
		wait(0.1)
		if nil then
			print("yes")
			isnil = true
		else
			print("not nil")
			isnil = false
		end
	until isnil == false
	    
		game.ReplicatedStorage.Dialogg4:FireClient(game.Players:FindFirstChild(NewNameP))
	    print("Worked!")
	end	
end
NumberD2 = 0
game.ReplicatedStorage.Dialogg18.OnServerEvent:Connect(Func)

7 comments

0

workspace.AllPlayer? if you want to get the players you should use game.Players:GetChildren(), or maybe im missing something

0

workspace.AllPlayer has all the Players that are currently in the game. If they die or lose a minigame, their stringvalue gets deleted.

0

and it prints "yes", or "not nil"? also, in every script ive made ive always used FindFirstChild() with " or ' when im having it search for something, though ive only used blank variables like your local NewNameF to define what it is before hand, or right after like a data save system

0

It prints "not nil".

0

Make sure game.ReplicatedStorage.Dialogg18.OnServerEvent:Connect(Func) is outside of the function.

0

It is.

0

Make sure the spelling is correct and I don’t know if you can call models/guis numbers try it with words only.

1 answer

Try removing the end on the LocalScript. The reason why is because FireServer doesn't require an end statement. I hope this helps you!

Example:

game.Players.LocalPlayer.PlayerGui.Dialog.Frame.Text.Text = "Lets go!"
wait(2)
print("Firing Server")
game.ReplicatedStorage.Dialogg18:FireServer()
print("Fired Server")

2 comments

0

I need the end because this is in a function.

1

Okay, so maybe try playing the function off of a click, button, etc and tell me what happens.

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