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 4 years ago

Hey there so i have two scripts.

01--SCRIPT
02 
03local RemoteEvent = game.ReplicatedStorage.RemoteEvent -- Assuming you placed the script inside the local script
04 
05RemoteEvent.OnServerEvent:Connect(function(player)
06    local model = player.Character
07 
08    for i, v in pairs(model:GetChildren()) do
09        if v:IsA("BasePart") then
10            v.Color = Color3.new(0.235294, 0.898039, 1)
11            model.Chest1.Eye.Color = Color3.new(0, 0, 0)
12            model.Chest1.FaceMask1.Color = Color3.new(1, 1, 1)
13            model.Chest1.FaceMask2.Color = Color3.new(1, 1, 1)
14        end
15    end
16end)

and

1--LOCAL SCRIPT
2 
3local Player = game.Players.LocalPlayer
4local RemoteEvent = game.ReplicatedStorage.RemoteEvent -- Assuming you placed it inside the script
5 
6script.Parent.MouseButton1Click:Connect(function()
7    RemoteEvent:FireServer()
8end)

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 4 years ago
Edited 4 years ago
1--local script
2 
3script.Parent.MouseButton1Click:Connect(function()
4    While true do
5        wait()
6        RemoteEvent:FireServer()
7    end
8end)
0
didn't seem to be helping. OreyTheOre 52 — 4y
Ad

Answer this question