So basically, I made a shop GUI that once you have bought something, it will clone a custom made sword, (it means I made it myself). But the problem is, that it doesn't work with damage in the real game. Here is the script that works with damage.
local canUse = true local isUsing = false local isUsingSpecial = false script.Parent.Activated:connect(function() isUsing = true wait(0.3) isUsing = false end) script.Parent.Blade.Touched:connect(function(hit) if isUsing == true then local random = math.random(1, 2) local hum = hit.Parent:WaitForChild("Humanoid") hum:TakeDamage(40) local stunanim0 = hum:LoadAnimation(script.Stun0) local stunanim1 = hum:LoadAnimation(script.Stun1) if random == 1 then stunanim0:Play() elseif random == 2 then stunanim1:Play() end wait(0.2) isUsing = false elseif script.Parent.isUsingSpecial.Value == true then isUsing = false local random = math.random(1, 2) local hum = hit.Parent.Humanoid hum:TakeDamage(20) local stunanim0 = hum:LoadAnimation(script.Stun0) local stunanim1 = hum:LoadAnimation(script.Stun1) if random == 1 then stunanim0:Play() elseif random == 2 then stunanim1:Play() end wait(0.5) script.Parent.isUsingSpecial.Value = false elseif script.Parent.isUsingSpecialE.Value == true then isUsing = false local random = math.random(1, 2) local hum = hit.Parent.Humanoid hum.WalkSpeed = 0 hum:TakeDamage(50) local stunanim0 = hum:LoadAnimation(script.Stun0) local stunanim1 = hum:LoadAnimation(script.Stun1) if random == 1 then stunanim0:Play() elseif random == 2 then stunanim1:Play() end wait(0.5) hum.WalkSpeed = 16 script.Parent.isUsingSpecialE.Value = false end end)
And the output says, "Blade is not a valid member of Tool". (picture under) https://gyazo.com/e70039d4362a6d8f9413113c375013db
Here's the shop script:
local plr = game.Players.LocalPlayer local replicatedstorage = game:GetService('ReplicatedStorage') script.Parent.MouseButton1Click:Connect(function() if plr.leaderstats.Jewls.Value >= 500 then wait(1) replicatedstorage.Chronicle:Clone().Parent = plr.Backpack plr.leaderstats.Jewls.Value = plr.leaderstats.Jewls.Value - 500 end end)
Please help me, because I'm really stuck here. My disc is UnitedDev#5580, if you can't explain it here.