Hello.
I'm hoping this is something silly and easily fixed. For some reason, the same model sword does not work when its granted to the player from ReplicatedStorage, compared to if it's in a StarterPack.
So, if a player has a Sword in their StarterPack, it works, fine. If its picked up on the map by the Player, it works fine.
But, when the player is granted the exact same Sword from ReplicatedStorage when the DataStore kicks in, and its cloned to the Player's Backpack, the Sword does not work, at all. (other items, like Guns, work fine.)
I have the game restricted to R6 models only, in case there was some problem there. Fun part? Inside Studio it works just fine, but when I upload to the site, is when this problem happens.
No error outputs of any kind. I've tried multiple sword scripts, as I've read that the one included in the RobloxSets is broken when R15 comes in to play. Surely this is something dumb on my part that can be easily fixed, right? The game is also Filtering Enabled.
Here's the two scripts, there's nothing special about them, RemoteEvent and Animations included inside the Tool, Sounds inside the Handle.
Script:
local tool = script.Parent
local speedboost = 1.25
local damage = 10
local swingtime = 1
local combowindow = .5
local debris = game:GetService("Debris")
local handle = tool:WaitForChild("Handle")
local event = tool:WaitForChild("RemoteEvent")
local slashsound = handle:WaitForChild("SlashSound")
local overheadsound = handle:WaitForChild("OverheadSound")
local lungesound = handle:WaitForChild("LungeSound")
local lastclick = tick()
local combo = 0
local hithumanoids = {}
handle.Touched:connect(function(hit)
if equipped and character and humanoid and humanoid.Health > 0 and hit and not hit:isDescendantOf(character) then
local targethumanoid = hit.Parent:FindFirstChild("Humanoid")
if targethumanoid and targethumanoid.Health > 0 and not hithumanoids[targethumanoid] then
hithumanoids[targethumanoid] = true
for _, v in pairs(targethumanoid:GetChildren()) do
if v and v.Name == "creator" then
v:remove()
end
end
local tag = Instance.new("ObjectValue")
tag.Name = "creator"
tag.Value = player
debris:AddItem(tag, 3)
tag.Parent = targethumanoid
targethumanoid:TakeDamage(damage * (combo + 1))
end
end
end)
tool.Activated:connect(function()
local clickdelta = tick() - lastclick
if clickdelta > swingtime then
lastclick = tick()
hithumanoids = {}
if clickdelta < swingtime + combowindow then
combo = (combo + 1) % 3
else
combo = 0
end
if player then
if combo == 0 then
event:FireClient(player, "RunAnimation", "SlashAnim2")
slashsound:Play()
elseif combo == 1 then
event:FireClient(player, "RunAnimation", "ThrustAnim2")
overheadsound:Play()
elseif combo == 2 then
event:FireClient(player, "RunAnimation", "OverheadAnim2")
lungesound:Play()
end
end
end
end)
tool.Equipped:connect(function()
equipped = true
lastclick = tick()
combo = 0
character = tool.Parent
player = game.Players:GetPlayerFromCharacter(character)
humanoid = character:FindFirstChild("Humanoid")
if humanoid then
humanoid.WalkSpeed = humanoid.WalkSpeed * speedboost
else
character = nil
end
end)
tool.Unequipped:connect(function()
equipped = false
if humanoid then
humanoid.WalkSpeed = humanoid.WalkSpeed / speedboost
end
character = nil
humanoid = nil
end)
Local Script:
local tool = script.Parent
local event = tool:WaitForChild("RemoteEvent")
event.OnClientEvent:connect(function(...)
local tuple = {...}
if tuple[1] == "RunAnimation" then
local anim = tool:FindFirstChild(tuple[2])
if anim and humanoid then
local loadedanim = humanoid:LoadAnimation(anim)
if loadedanim then
loadedanim:Play()
if themouse then
themouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
wait(1)
themouse.Icon = "rbxasset://textures\\GunCursor.png"
end
end
end
end
end)
tool.Equipped:connect(function(mouse)
themouse = mouse
humanoid = tool.Parent:FindFirstChild("Humanoid")
if humanoid then
local anim = tool:FindFirstChild("IdleAnim3")
if anim and humanoid then
if loadedidleanim then
loadedidleanim:Stop()
end
loadedidleanim = humanoid:LoadAnimation(anim)
if loadedidleanim then
loadedidleanim:Play()
end
end
local anim = tool:FindFirstChild("EquipAnim")
if anim and humanoid then
local loadedanim = humanoid:LoadAnimation(anim)
if loadedanim then
loadedanim:Play()
end
end
end
if themouse then
themouse.Icon = "rbxasset://textures\\GunCursor.png"
end
end)
tool.Unequipped:connect(function()
if loadedidleanim then
loadedidleanim:Stop()
end
end)
Here is the script that clones the Tools from ReplicatedStorage:
local player = game:GetService("Players").LocalPlayer
local rs = game:GetService("ReplicatedStorage")
player.CharacterAdded:Connect(function(character) --When the character is loaded
if player.Inventory.HasMasterSword.Value == true then
local MasterSword = rs.MasterSword:Clone()
MasterSword.Parent = player.Backpack
print("MasterSword Cloned for" .. player.Name .."")
end
Again, the script does successfully clone the Tools into the player's backpack, but the Swords just don't work once they're cloned, but the guns do.

6 comments
Show the script that gives it from repstor, the glitch might be there.
Thanks for the response, I added the script to the main post. Again, the swords DO clone to the player's backpack, and the guns work...but the swords don't. o.o;; Yet swords that are picked off the map, with the exact same script, work.
It's a party of deprecated things woo hoo
Maybe, but that doesnt explain why i can pick the item up on the map and ot swings, but when its cloned intk the backpack it doesnt. ....or does it explain why?
https://forum.scriptinghelpers.org/topic/192/how-to-use-localplayer
hiimgoodpack - I appreciate the time you took to comment, however, how does the link to your forum thread help? As mentioned, the bottom script successfully clones the Sword, Guns, Potions, etc into the Player's backpack. The Guns work fine. The Swords do not. However, if the same Sword is picked up on the map, it works fine.