#script issue with 2 parts
11 messages · Page 1 of 1 (latest)
pistol: ```local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local debounce = false
local Pistol = ReplicatedStorage:WaitForChild("Pistol") -- put the name of the sword here
local Part = script.Parent
Part.Touched:Connect(function(hit) -- 'hit' is what touched the Part
if hit.Parent:FindFirstChildWhichIsA("Humanoid") then -- if humanoid exists
local player = Players:GetPlayerFromCharacter(hit.Parent)
if player then
if player.Backpack:FindFirstChild("Pistol") or player.Character:FindFirstChild("Pistol") then -- if sword exists in the backpack or is already equipped
player.Character:WaitForChild("Humanoid"):UnequipTools() -- unequips any tool
player.Backpack:FindFirstChild("Pistol"):Destroy()-- removes the sword
else -- if sword is not in the backpack or if the sword isnt equipped
Pistol:Clone().Parent = player.Backpack-- clones and places the sword in the backpack
end
end
end
end)```
ak: ```local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local debounce = false
local ak = ReplicatedStorage:WaitForChild("ak") -- put the name of the sword here
local Part = script.Parent
Part.Touched:Connect(function(hit) -- 'hit' is what touched the Part
if hit.Parent:FindFirstChildWhichIsA("Humanoid") then -- if humanoid exists
local player = Players:GetPlayerFromCharacter(hit.Parent)
if player then
if player.Backpack:FindFirstChild("ak") or player.Character:FindFirstChild("ak") then -- if sword exists in the backpack or is already equipped
player.Character:WaitForChild("Humanoid"):UnequipTools() -- unequips any tool
player.Backpack:FindFirstChild("ak"):Destroy()-- removes the sword
else -- if sword is not in the backpack or if the sword isnt equipped
ak:Clone().Parent = player.Backpack-- clones and places the sword in the backpack
end
end
end
end)```
is it just me or isnt that video moving? just a image
first thing is to check the output for any errors in that script
also, what script of those two is working? (if any of them)
its a video
** You are now Level 1! **
both of them work
then whats the issue...
i think both of the scripts code interrupt with eachother
im gonna close this