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

event:FireAllClients() doesn't work for my script... Anyone could help me?

Asked by
JoneXI 51
4 years ago
Edited 4 years ago

Hello, There is a health value, whenever you touch a spike it lowers for 1. I have this script(Serverscript):

while test == true do wait()
    if health.Value < 2 then
        event1:FireAllClients()
        test = false
    end
end

If on line 3 I do a print("something") It prints it once, everything is fine, but if I do remoteEvent it doesn't work... Local script:

event1.OnClientEvent:Connect(function()
    script.Parent.Parent.health1.Visible = false
end)

Thank you.

2
Make it print on the remote event function, and see if it prints. User#32819 0 — 4y
0
What happen when the script run? Block_manvn 395 — 4y
0
Yea, it prints. That means the problem is in the local script's line 2, but I dont get what's the problem :d JoneXI 51 — 4y
0
can you send me a picture of your explorer? include all the things mentioned in the script above guest_20I8 266 — 4y
View all comments (3 more)
0
Yea, I could but I cant send any pictures here or at Roblox, Maybe u could give me your Discord? JoneXI 51 — 4y
0
Nvm it worked JoneXI 51 — 4y

1 answer

Log in to vote
0
Answered by
JoneXI 51
4 years ago

Also here is the full script:

local event = game:GetService("ReplicatedStorage").Health
local event1 = game:GetService("ReplicatedStorage").Health1
local test = true

local debounce = false
game.Players.PlayerAdded:Connect(function(player)

    local health = Instance.new("IntValue", player)
    health.Name = "Health"
    health.Value = 3




    for i,v in pairs(workspace.Spikes:GetChildren()) do
v.Touched:Connect(function()
    if not debounce then
        debounce = true
        health.Value = health.Value - 1
        wait(5)
        debounce = false
            end
        end)
    end 

    repeat wait()
        if health.Value < 3 then
            event:FireAllClients()

        end
        until   health.Value < 3

while test == true do wait()
    if health.Value < 2 then
        event1:FireAllClients()
        test = false
    end
end

end)

And a picture of the explorer https://prnt.sc/rqa8ky

Ad

Answer this question