#tool not activating, and server script isnt working

1 messages · Page 1 of 1 (latest)

hexed thicket
#

local script

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Remotes = ReplicatedStorage:FindFirstChild("Remotes")

local tool = script.Parent

tool.Activated:Connect(function()
    Remotes.ToolActivated:FireServer()
end)

server script

local Remotes = ReplicatedStorage:FindFirstChild("Remotes")
local tools = ServerStorage:FindFirstChild("Tools")
local scripts = ServerStorage:FindFirstChild("Scripts")

local ToolConfig = require(ReplicatedStorage:FindFirstChild("Config"):FindFirstChild("ToolConfig"))

Remotes.ToolActivated.OnServerEvent:Connect(function(player:Player)
    print("ServerFired")
    local PlayerTool = player.Inventory.EquippedTool.Value
    for tool, ToolTable in pairs(ToolConfig) do
        if tool == PlayerTool then
            player.leaderstats.E.Value += ToolTable.EPoints
        end
    end
end)

for i, tool in ipairs(tools:GetChildren()) do
    local script = scripts.Click:Clone()
    script.Parent = tool
end

on player added local script will be cloned and parented to the tool that the player has in their backpack

rose plume
#

ask chatgpt

hexed thicket
#

one step ahead, it just dont work

rose plume
#

what about the built in assistant

hexed thicket
#

let me try that

rose plume
#

it does the placing and coding for u

hexed thicket
#

fixed it

plucky zenith
#

You mean it doesn't print "ServerFired"?

hexed thicket
#

no no i had just forgotten to turn on manual activation thingy, im new to using tools