Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

im makeing a jojo game and my script is not working can i have help figuring it out?

im making a jojo game and i need help im super new to lua and if you could help me figure it out i would be very happy

heres the script

local Arrow = script.Parent local Click = Arrow:WaitForChild("Click")

Click.MouseClick:Connect(function(player)

local Backpack = player:FindFirstChild("Backpack")
if Backpack then
    local Stands = game:GetService("ServerStorage"):WaitForChild("Stands")
   
    local PlrStats = player:WaitForChild("PlrStats")
    local currentStand = PlrStats:WaitForChild("Stand")
   
    
    if PlrStats.Stand.Value ~= "stand1" then
        --Give Stand3
        if Backpack:FindFirstChild("Stand1") or Backpack:FindFirstChild("Stand2") or Backpack:FindFirstChild("Stand3") then
            local prevStand = workspace:FindFirstChild(player.Name.." Stand")
            local prev = Backpack:FindFirstChild("Stand1") or Backpack:FindFirstChild("Stand2") or Backpack:FindFirstChild("Stand3")
            prevStand:Destroy()
            prev:Destroy()
           
            local Stand = Stands:FindFirstChild("Stand3"):Clone()
            Stand.Parent = Backpack
           
            currentStand.Value = "Stand3"
        else
            local Stand = Stands:FindFirstChild("Stand3"):Clone()
            Stand.Parent = Backpack
           
            currentStand.Value = "Stand3"

end

2 comments

0

Can you explain what you're trying to do with the script?

0

im trying to make if i have stand1 i get stand3 if i click it

1 answer

✓ Accepted answer
local Backpack = player:FindFirstChild("Backpack")
if Backpack then
    local Stands = game:GetService("ServerStorage"):WaitForChild("Stands")

    local PlrStats = player:WaitForChild("PlrStats")
    local currentStand = PlrStats:WaitForChild("Stand")


    if PlrStats.Stand.Value ~= "stand1" then
        --Give Stand3
        if Backpack:FindFirstChild("Stand1") or Backpack:FindFirstChild("Stand2") or Backpack:FindFirstChild("Stand3") then
            local prevStand = workspace:FindFirstChild(player.Name.." Stand")
            local prev = Backpack:FindFirstChild("Stand1") or Backpack:FindFirstChild("Stand2") or Backpack:FindFirstChild("Stand3")
            prevStand:Destroy()
            prev:Destroy()

            local Stand = Stands:FindFirstChild("Stand3"):Clone()
            Stand.Parent = Backpack

            currentStand.Value = "Stand3"
        else
            local Stand = Stands:FindFirstChild("Stand3"):Clone()
            Stand.Parent = Backpack

            currentStand.Value = "Stand3"
	end
	end
end

4 comments

0

mabye

0

it did not work

0

nvm sorry i works!

0

now its saying somthings wrong with local backpack= player

This discussion is preserved as it was. New answers, comments, and votes are closed.