Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago
Edited 4 years ago

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)
0
The first parameter given in .OnServerEvent is the ClientFired Player Object. All trailing parameters are then what you pass. Ziffixture 6913 — 4y
0
I have added the player to that, but apparently, does not work. Still warns myself xxMVG_Fan8xxALT 1 — 4y

1 answer

Log in to vote
1
Answered by
Leamir 3138 Moderation Voter Community Moderator
4 years ago
Edited 4 years ago

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)
0
That does not help me xxMVG_Fan8xxALT 1 — 4y
0
I need, that It does NOT use the player's username, because it warns my username xxMVG_Fan8xxALT 1 — 4y
1
it's just ignore that parameter on the server, if you test this script, it should work Leamir 3138 — 4y
0
It prints "xxMVG_Fan8xxALT" and not for example "01:02" xxMVG_Fan8xxALT 1 — 4y
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 Leamir 3138 — 4y
Ad

Answer this question