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

How do i make my remote event script work more than once?

Asked by 3 years ago

Hey there so i have two scripts.

--SCRIPT

local RemoteEvent = game.ReplicatedStorage.RemoteEvent -- Assuming you placed the script inside the local script

RemoteEvent.OnServerEvent:Connect(function(player)
    local model = player.Character

    for i, v in pairs(model:GetChildren()) do
        if v:IsA("BasePart") then
            v.Color = Color3.new(0.235294, 0.898039, 1)
            model.Chest1.Eye.Color = Color3.new(0, 0, 0)
            model.Chest1.FaceMask1.Color = Color3.new(1, 1, 1)
            model.Chest1.FaceMask2.Color = Color3.new(1, 1, 1)
        end
    end
end)

and

--LOCAL SCRIPT

local Player = game.Players.LocalPlayer
local RemoteEvent = game.ReplicatedStorage.RemoteEvent -- Assuming you placed it inside the script

script.Parent.MouseButton1Click:Connect(function()
    RemoteEvent:FireServer()
end)

But this RemoteEvent script works once. How do i make it work everytime? Also please tell me which script i should change. Thanks!

1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago
--local script

script.Parent.MouseButton1Click:Connect(function()
    While true do
        wait()
        RemoteEvent:FireServer()
    end
end)
0
didn't seem to be helping. OreyTheOre 52 — 3y
Ad

Answer this question