Ad
Log in to vote
0

Why is this remote event not working, server --> client?

Asked by 12 days ago
Edited 12 days ago

Hello, I'm trying to get this remote event working for a few days now and i cant get it to work. I hope someone can help me. tell me if i need to post the full script, now i only posted the remote event parts.

--server


local RemoteEvent = Instance.new("RemoteEvent")

local click = script.Parent:WaitForChild("ClickDetector")

click.MouseClick:Connect (function(player)
    RemoteEvent:FireClient(player)
    wait(5)
    for _,v in pairs (script.Parent.Parent.Leaves:GetChildren()) do
    if v:IsA("Part") then--Checks if the Child that is inside the Model is ClassName Part.
    v.Anchored = false
    end
end
    for _,v in pairs (script.Parent.Parent.Logs:GetChildren()) do
    if v:IsA("Part") then--Checks if the Child that is inside the Model is ClassName Part.
    v.Anchored = false
    end
end
   script.Parent.Parent.Wood:Destroy()

end)


--client

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvent = ReplicatedStorage:WaitForChild("RemoteEvent")


local function RemoteSmall()
    GetWood = false
    WC = plr.PlayerGui.WoodChopper
    WC.BG.Visible = true
    char.Humanoid.WalkSpeed = 0
    char.Humanoid.JumpPower = 0
    animation:Play()
    ShowProgress('SmallTree1')
    animation:Stop()
    char.Humanoid.WalkSpeed = 16
    char.Humanoid.JumpPower = 50

end


RemoteEvent.OnClientEvent:Connect(RemoteSmall)

0
Include the all the code for the server script. unsatisfie_d 1207 — 12d
0
Done Alwaysrube 13 — 12d

1 answer

Log in to vote
0
Answered by 12 days ago

The reason why your system does not work is because you create a RemoteEvent without parenting it to ReplicatedStorage. This simply causes the client to yield until the RemoteEvent to exist or just indefinitely.

Simple fix:

local RemoteEvent = Instance.new("RemoteEvent");
RemoteEvent.Parent = game:GetService("ReplicatedStorage");
0
Omg Thanks!! Alwaysrube 13 — 12d
Ad

Answer this question