I have an event (RemoteEvent) that fires on all of the clients. When this happens the game is supposed to clone a sword into everyone's inventory. This works without errors, but the sword is unusable, when trying to use it, it simply doesn't do anything. I suspect this has to do with the script that clones the gear. The following script is a local script located in StarterGui:
local Players = game:GetService("Players") local Events = game.ReplicatedStorage.Events Events.DefaultModeStart.OnClientEvent:Connect(function() wait(15) game.ReplicatedStorage.ClassicSword:Clone().Parent = game.Players.LocalPlayer.Backpack end)
This is the script that fires the event: (Script located in Workspace) What this is supposed to do is wait 15 seconds, teleport the players, then clone the gear.
local Events = game.ReplicatedStorage.Events Events.DefaultModeStart:FireAllClients() -- Start Event -- TP Players wait(15) target = CFrame.new(175.5, 68.5, 1247.5) for i, player in ipairs(game.Players:GetChildren()) do --Make sure the character exists and its HumanoidRootPart exists if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then --add an offset of 5 for each character player.Character.HumanoidRootPart.CFrame = target + Vector3.new(0, i * 5, 0) end end
when you clone a tool on the client, any server-side code won't run
the classic sword has a lot of code on the server so. it won't work, of course
to fix it you just have to clone the tool on the server instead of the client
for i, player in ipairs(game.Players:GetPlayers()) do game.ReplicatedStorage.ClassicSword:Clone().Parent = player.Backpack end