Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why is my event not firing/receiving?

Why isn't this remote firing/reciving. there is no errors.

This is the Local Script


---Services
local UIS = game:GetService("UserInputService")
local repstorage = game:GetService("ReplicatedStorage")
---Services


--Variables
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local target = mouse.Target
local gui = player.PlayerGui:WaitForChild("Items")
local text
local l = "no Break"
--Variables

UIS.InputChanged:Connect(function()
        if mouse.Target then
        if mouse.Target:FindFirstChild("grabbable") then
            local Target = mouse.Target
            gui.Enabled = true
            gui.Adornee = Target
            text = Target.Name
            gui.TargetFrame.TextLabel.Text = text
            local X = (Target.Size.X)
            local Y =  (Target.Size.Y)
            local Z = (Target.Size.Z)
            gui.StudsOffset = Vector3.new(X,3,Z)
        else
            gui.Enabled = false
            gui.Adornee = nil
            text = nil
        end
    end
end)
            
UIS.InputBegan:Connect(function(p, input)
    if player.PlayerGui.Items.Enabled then
        if not input then
            if p.KeyCode == Enum.KeyCode.T then
                print(player.PlayerGui.Items.TargetFrame.TextLabel.Text)
                local remote = game.ReplicatedStorage.Remotes.itemRemote
                local value2 = mouse.Target.itemName.Value
                local value3 = mouse.Target.Numberof.Value
                remote:FireServer(player, value2, value3)
            end
        end
    end
end)

This is the Module script

local remote = game.ReplicatedStorage.Remotes.itemRemote

remote.OnServerEvent:Connect(function(player, name, var2)
    print("error previous")
    if player == script.Parent.Parent.Name then
        print("error here")
        local index = table.find(Inventory, name)
        print(index)
    end
end)

Inventory = {
--crystal = {"name", #, 0.1, nil, bleedStage(1-3)}
Blue_Kyber_Crystal = {"Blue Kyber Crystal", 0, 0.1, nil, 0},
Teal_Kyber_Crystal = {"Blue Kyber Crystal", 0, 0.1, nil, 0},
Green_Kyber_Crystal = {"Green Kyber Crystal", 0, 0.1, nil, 0},
Yellow_Kyber_Crystal = {"Yellow Kyber Crystal", 0, 0.1, nil, 0},
Purple_Kyber_Crystal = {"Purple Kyber Crystal", 0, 0.1, nil, 0},
Red_Kyber_Crystal = {"Red Kyber Crystal", 0, 0.1, nil, 0},
White_Kyber_Crystal = {"White Kyber Crystal", 0, 0.1, nil, 0},
Black_Kyber_Crystal = {"Black Kyber Crystal", 0, 0.1, nil, 0},






}
return Inventory

1 answer

If you require a ModuleScript with a LocalScript then the ModuleScript will act like a LocalScript, and runs like a LocalScript, this is the same as Script (Server Script), since LocalScript cannot run server restricted (events, functions) it wont do anything, because it's restricted

3 comments

0

I didn't require at all, and I am using a remote Event to communicate.

0

ModuleScripts are usually not for this type of task, but does your server script require the module first, before the client?

0

yes

This discussion is preserved as it was. New answers, comments, and votes are closed.