#RenoteEvent doesn’t work

1 messages · Page 1 of 1 (latest)

red ruin
#

My script doesn’t load the parameters in the SpawnMorph function

#

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Morph = ReplicatedStorage:WaitForChild("Morph")
local SpawnMorph = ReplicatedStorage:WaitForChild("SpawnMorph")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Weapons = require(script.Weapons)

local spawnPoints = {
["Spawn1"] = workspace:WaitForChild("SpawnGAR"),
["Spawn2"] = workspace:WaitForChild("SpawnRaider"),
}

SpawnMorph.OnServerEvent:Connect(function(player, divisionName, morphName, spawnName)
print("Spawn")
local folder = Morph:FindFirstChild(divisionName)
if not folder then
warn("Divisione non trovata:", divisionName)
return
end

local model = folder:FindFirstChild(morphName)
if not model then
    warn("Morph non trovato:", morphName)
    return
end

local spawnLocation = spawnPoints[spawnName]
if not spawnLocation then
    warn("Spawn non trovato:", spawnName)
    return
end

local clone = model:Clone()
clone.Name = player.Name

clone:SetPrimaryPartCFrame(spawnLocation.CFrame + Vector3.new(0, 5, 0))

player.Character = clone
clone.Parent = workspace

print(player.Name .. " spawnato come morph " .. morphName .. " in " .. spawnName)

end)

--[[local function GiveWeapons(player, groupID, morph)
if player:WaitForChild("leaderstats").Arrested.Value == true then
return
end

for i,v in pairs(Weapons) do
    for _,weapon in pairs(v.Weapons) do
        if v.Id ~= groupID then
            continue
        end
        if not player.Backpack:FindFirstChild(weapon.Name) then
            weapon:Clone().Parent = player.Backpack
        end
    end
end
for _, divguns in pairs(morph:GetChildren()) do
    if divguns:IsA("Tool") then
        if not player.Backpack:FindFirstChild(divguns.Name) then
            divguns:Clone().Parent = player.Backpack
        end
    end
end

end]]

#

local player = game.Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local selectGAR = playerGui:WaitForChild("SelectGAR")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local SpawnMorph = ReplicatedStorage:WaitForChild("SpawnMorph")

local spawnButton = script.Parent

spawnButton.MouseButton1Click:Connect(function()
local selectedDivision = player:FindFirstChild("SelectDivision")
local selectedMorph = player:FindFirstChild("SelectMorph")

print("pulsante premuto")

if selectedDivision and selectedMorph then
    if selectedDivision.Value == "" or selectedMorph.Value == "" then
        warn("Devi selezionare divisione e morph prima di spawnare.")
        return
    end

    print("carica morph")
    SpawnMorph:FireServer(selectedDivision.Value, selectedMorph.Value, "Spawn1")
    selectGAR.Enabled = false
else
    warn("SelectDivision o SelectMorph non trovati nel player.")
end

end)

#

I have SpawnMorph event in the ReplicatedStorage

haughty ore
#

If you'd worked with RemoteEvents, you'd know why already. Plus I don't this you wrote this script.

#

You should try making a RemoteEvent work by yourself from scratch in RS

red ruin
#

Do you want to help me or not?

red ruin
spice cosmos
#

is this ai...

red ruin
#

No!

spice cosmos
red ruin
#

No error

spice cosmos
#

Is it local or no local

red ruin
#

What?

spice cosmos
#

i thought there were both a single script lol

#

on what line of the local script are you firing to server

red ruin
#

The print is working

#

But the first print in the script doesnt work.

#

I think I have a problem in load parameters

spice cosmos
#

idk

wooden silo
#

fairly basic debugging steps y'know make sure things are in the right place, spelled correctly, test confirm things are actually running. basic, basic stuff.

terse bayBOT
#

studio** You are now Level 6! **studio

red ruin
#

Give me 1 sec

wooden silo
#

and obviously if you're getting any errors at all, you can't expect anything else to work

red ruin
#

No the script work

#

I added hello and it’s work

wooden silo
# red ruin

oh boy i do wonder what all those things above it say

red ruin
#

they have nothing to do with the script

#

Do you want a copy?

wooden silo
#

definitely not errors or warnings, and completely unrelated to things not working. let's keep believing that, and maybe pray to the roblox luau jesus to bestow a magical miracle upon your code to fix itself. hmm yes indeed no need to investigate those errors or warnings any further at all. roblox luau jesus will save you!

red ruin
#

Bro.

wooden silo
#

fix your errors and warnings -_-

red ruin
#

Those are errors related to doors

wooden silo
#

scroll further up

#

also

#

fix them anyway

red ruin
#

I fixed

wooden silo
#

tbh you could prove its the errors by creating a new script with nothing but a connection to the event and a print in it, nothing else

red ruin
#

Thx.

#

It was not the door.

#

It was the require method

wooden silo
red ruin
#

But no error

#

So bah

#

Fix now!

wooden silo
#

if the require infinite yields, that is just as much a problem

#

so ye this is called error cascade - it's when an error or other problem, such as infinite yield, happens early on in the code, nothing after that error will work properly. sometimes you get lucky, sometimes you don't.

#

A cascading failure is a failure in a system of interconnected parts in which the failure of one or few parts leads to the failure of other parts, growing progressively as a result of positive feedback. This can occur when a single part fails, increasing the probability that other portions of the system fail. Such a failure may happen in many ty...

red ruin
#

Do you know how to remove Kohl admin for a member?

wooden silo
#

bruh idk what your admin module is i make my own stuff

red ruin
#

Oh ok thank u man

wooden silo
#

google is your friend

red ruin
#

Bro you are not my network and system teacher….

#

Lol

wooden silo
#

as far as you think you know rizz