Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What is wrong with my script?

Asked by 9 years ago

objects = {} wait(1)

script.Parent:WaitForChild("Buttons") for i,v in pairs(script.Parent.Buttons:GetChildren()) do if v:FindFirstChild("Head") then

    local oject = script.Parent.Purchases:FindFirstChild(v.Object.Value)    
    if objects ~= nil then
        objects[object.Name] = object:Clone{}
        object:Destory()
    else
        print("Button: "..v.Name.." is missing its object and has been removed.")
        v.CanCollide =  false
        v.Transparency = 1
end

    v.Head.Touched:connect(function(hit)
        local player =  game.PlayersGetPlayerFromCharacter(hit.Parent)
        if v.Head.CanCollide == true
            if player ~= nil then
                if script.Parent.Owner.Value == player then
                    if hit.Parent:FindFirstChild("Humanoid") then
                        if hit.Parent.Humanoid.Health > 0 then
                            local cashmoney = game.ServerStorage.MoneyStorage:FindFirstChild(player.Name)
                            if cashmoney ~= nil then
                                if cashmoney.Value >= v.Price.Value then
                                    cashmoney.Value = cashmoney.Value - v.Price.Value
                                    objects[v.Object.Value].Parent= script.PurchasedObjects
                                    v.Head.CanCollide =  false
                                    v.Head.Transparency = 1
                                end
                            end
                        end
                    end
                end
            end
            end
        end)
    end
end
0
it says " if player ~= nil then" is incorrect. the "if" is on line 14 PinkBawb 0 — 9y
0
Can you get the whole thing inside the code block? Validark 1580 — 9y
0
'local oject = script.Parent.Purchases:FindFirstChild(v.Object.Value)' 'oject' Typo? Mr_Octree 101 — 9y

1 answer

Log in to vote
0
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
9 years ago

object is spelled incorrectly as oject on (what is currently) line 1.

game.PlayersGetPlayerFromCharacter is written on line 12; it should read game.Players:GetPlayerFromCharacter.

if v.Head.CanCollide == true is missing then after it on line 13.

Ad

Answer this question