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

Why do my tools stop working if I clone them into the backpack from replicatedstorage?

Asked by 8 years ago
Edited 8 years ago

If I were to put them into the StarterPack, they all work perfectly. Also note this game is in FE.

EDIT: I found out that the LocalScript in the tool runs, while the ServerScript in the tool doesn't!

Server Script:

print("hi") --                <-- THIS DOES NOT PRINT
Tool = script.Parent
CB = script.Parent.CreateBrick

CB.OnServerEvent:connect(function(plr,cb,offset,target,mode,block,ts)
    print("hello world".. ts)
end)

EDIT #2: The ServerScript works perfectly. There are no errors. The only problem is that it just isn't running! Disabled is false. I checked.

0
What's wrong with the script, are there any errors? UniversalDreams 205 — 8y
0
You aren't giving us much to work with. Check if it's disabled. If not, we need a lot more info. GoldenPhysics 474 — 8y
0
I was requested to give the ServerScript. Here it is. The only problem is that it doesn't run at all. The LocalScript fires the remoteevent in the tool. laughablehaha 494 — 8y
0
Does the tool parts fall off the map when you clone it from ReplicatedStorage to backpack? BinaryResolved 215 — 8y
0
Are you cloning the tool using a localscript or a server script? Sceleratis 65 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago
Edited 8 years ago

First make an script and put in ServerScriptService, you can name it whatever you want put the Tool in ServerStorage then try this:

serverStorage = game:GetService("ServerStorage")-- Gets ServerStorage

while true do
        wait(5)
        Gamers = {}-- name of players(This is a table)
        for _, player in pairs(game.Players:GetPlayers()) do --get the players and makes sure they are alive
            if player and player.Character then
                local humanoid = player.Character:WaitForChild("Humanoid")--looks for humanoid
                if humanoid and humanoid.Health > 0 then -- checks that the health is over 0
                    table.insert(Gamers, player)-- inserts players into the table gamers
                end
            end
        end
    end

backpack = game.Workspace.Players:FindFirstChild("Backpack")-- looks for backpack
if backpack and Gamers then --if the player has a backpack and is a player then the tool will get clone into the backpack
local tool = serverStorage:WaitForChild("Tool"):clone()--clones the tool so that we can always have it for a future use
tool.Parent = backpack -- sets the tool parent to the backpack

I not sure if this works, maybe I just wasted my time writting this code. Just Started learning and im trying to help. Cheers!

Ad

Answer this question