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

RemoteEvent:FireClient() Question, a message appear which is not being fired. How can I fix this?

i fire a number.

local hourcount = 01
local minutecount = 00





script.Parent.Hour.MouseButton1Click:Connect(function()
	hourcount = hourcount + 1
	if hourcount <= 10 then
		hourcount = "0"..hourcount
	else
			hourcount = hourcount
	end
	if hourcount == 24 then
		hourcount = 00
	end
	script.Parent.Hour.Text = hourcount
end)

script.Parent.Minute.MouseButton1Click:Connect(function()
	minutecount = minutecount + 1
	if minutecount <= 10 then
		minutecount = "0"..minutecount
	else
			minutecount = minutecount
	end
	if minutecount == 60 then
		minutecount = 00
	end
	script.Parent.Minute.Text = minutecount
	
end)

script.Parent.Submit.MouseButton1Click:Connect(function()
game.ReplicatedStorage.SmoothShutdown.TimeSet:FireServer(player,hourcount..":"..minutecount)
end)

and then when I pick it up on the server, it prints my username.

game.ReplicatedStorage.SmoothShutdown.TimeSet.OnServerEvent:Connect(function(player,shutdowntime)
	warn(shutdowntime)
	game.ReplicatedStorage.SmoothShutdown.TimeSet:FireAllClients(shutdowntime)
end)

2 comments

0

The first parameter given in .OnServerEvent is the ClientFired Player Object. All trailing parameters are then what you pass.

0

I have added the player to that, but apparently, does not work. Still warns myself

1 answer

✓ Accepted answer

Hello, xxMVG_Fan8xxALT!

Edit your local script:

local hourcount = 01
local minutecount = 00





script.Parent.Hour.MouseButton1Click:Connect(function()
    hourcount = hourcount + 1
    if hourcount <= 10 then
        hourcount = "0"..hourcount
    else
            hourcount = hourcount
    end
    if hourcount == 24 then
        hourcount = 00
    end
    script.Parent.Hour.Text = hourcount
end)

script.Parent.Minute.MouseButton1Click:Connect(function()
    minutecount = minutecount + 1
    if minutecount <= 10 then
        minutecount = "0"..minutecount
    else
            minutecount = minutecount
    end
    if minutecount == 60 then
        minutecount = 00
    end
    script.Parent.Minute.Text = minutecount

end)

script.Parent.Submit.MouseButton1Click:Connect(function()
game.ReplicatedStorage.SmoothShutdown.TimeSet:FireServer(hourcount..":"..minutecount) -- the player parameter is automatically sent
end)

Server Script:

game.ReplicatedStorage.SmoothShutdown.TimeSet.OnServerEvent:Connect(function(player,shutdowntime)
    warn(shutdowntime)
    game.ReplicatedStorage.SmoothShutdown.TimeSet:FireAllClients(shutdowntime)
end)

5 comments

0

That does not help me

0

I need, that It does NOT use the player's username, because it warns my username

1

it's just ignore that parameter on the server, if you test this script, it should work

0

It prints "xxMVG_Fan8xxALT" and not for example "01:02"

1

It's impossible to not pass the player username, the only thing you can do is ignoring that variable... I made an edit to show exactaly how your scripts should be

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