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

Client not sending data to RemoteEvent, Any way to fix this?

Asked by 4 years ago
Edited 4 years ago

This is kinda hard for me to understand. But when the localscript trys to fire the server with variables it doesnt do anything The Remoteevent isnt sending back information to the specific client. ModuleScript: The code is massive.

local module = {}
return function(player1)
  local player = game.Players[player1]
    local ls = script.LocalScript
    ls.rememberthispls.Value = script
    ls.Parent = player.PlayerGui
    ls.Disabled = false
    --start serverscript
    local cha = player.Character
cha.Humanoid.Health = math.huge
cha.Humanoid.MaxHealth = math.huge
local hatmod = Instance.new("Model",cha)
local main = Instance.new("Part",hatmod)
local top = Instance.new("Part",hatmod)
local misc = Instance.new("Part",hatmod)

main.Size = Vector3.new(0.5, 3, 3)
top.Size = Vector3.new(2, 2, 2)
misc.Size = Vector3.new(0.558, 2.03, 3.045)

local maintopw = Instance.new("Motor6D",hatmod)
local topmiscw = Instance.new("Motor6D",hatmod)

maintopw.Part0 = main
maintopw.Part1 = top


topmiscw.Part0 = top
topmiscw.Part1 = misc

maintopw.C1 = CFrame.new(1,0,0)
topmiscw.C1 = CFrame.new(0.3,0,0)

main.Shape = "Cylinder"
top.Shape = "Cylinder"
misc.Shape = "Cylinder"

local headweld = Instance.new("Weld",main)
headweld.Part0 = cha.Head
headweld.Part1 = main
headweld.C1 = CFrame.new(0.75,0,0) *CFrame.Angles(0,0,math.rad(90))

main.BrickColor = BrickColor.Black()
top.BrickColor = BrickColor.Black()
local light = Instance.new("PointLight",misc)
light.Brightness = 90
light.Range = 8
--this is where the real party starts
local sound = Instance.new("Sound",cha.Head)
sound.Looped = true
sound.Volume = 5
local remote = Instance.new("RemoteEvent",script)

player.Chatted:Connect(function(msg)
        if msg:sub(1,5) == "/play" then
        local victim = msg:sub(1,5)
        local soundid = string.gsub(msg,victim,"")
        sound.SoundId = "rbxassetid://"..soundid
            script.ClientFire:Fire(player,"macaroniman",soundid)        
            sound:Play()
    elseif msg:sub(1,5) == "/stop" then
        sound:Stop()
    end
end)
    while true do wait()
        misc.Color = script.Color.Value
        light.Color = script.Color.Value
    end
    end

Script1: This handles the remoteevent and the bindable event

local remote = script.Parent:WaitForChild("RemoteEvent")
local bind = script.Parent.ClientFire
remote.OnServerEvent:Connect(function(player,value)
   script.Parent.Color.Value = Color3.new(value/math.random(2,5),value/math.random(2,5),value/math.random(2,5))

end)
bind.Event:Connect(function(player,unknown,id)
        remote:FireClient(player,unknown,id)
end)
--    remote:FireClient(player,"macaroniman",soundid)

LocalScript: Gets Parented to the players gui by the modulescript and gets enabled. Meant for handling audio playbackloudness and sending information back to the remoteevent

wait(3)
local player = game.Players.LocalPlayer
local sound = Instance.new("Sound",script)
sound.Looped = true
local requirethis = script.rememberthispls.Value
local remote = requirethis:WaitForChild("RemoteEvent")
remote.OnClientEvent:Connect(function(macaroni,id)
    sound.SoundId = "rbxassetid://"..id
    sound:Play()
end)
player.Chatted:Connect(function(msg)
    if msg:sub(1,5) == "/stop" then
        sound:Stop()
    end
end)
while true do
    wait()
    remote:FireServer(sound.PlaybackLoudness)
end

This is the code i use to run the module itself

local mod = require(workspace.HatMan) mod("antoniorigo4")

I'm sorry if the code is too big. I added some comments they arent that much important just to remember some things.

1 answer

Log in to vote
1
Answered by 4 years ago

This really looks like a party ????! Is there anything printing on the output, maybe "Remote event invocation queue exhausted" or etc.

0
No antoniorigo4 117 — 4y
0
Only gives a infinite yield on waitforchild("remoteevent") but when i start the module script its kinda working antoniorigo4 117 — 4y
0
Is this a 1 player only server? FunctionalMetatable 490 — 4y
0
If so, you might just have do do this on the server :D FunctionalMetatable 490 — 4y
0
Well Im planning to use the module on multiple games like void script builder antoniorigo4 117 — 4y
Ad

Answer this question