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

So I keep getting this error Expected '(','{' or <string>, got ':' On line 25. Help?

Asked by 4 years ago
Sand = game.Workspace:WaitForChild("Sand")
local TouchableParts = {}
local tableposition = 1

for i, v in pairs (Sand:GetChildren()) do
    if v:IsA("BasePart") then
        table.insert(TouchableParts, tableposition, v)
        tableposition = tableposition + 1
    end
end


local TouchableParts = {}
local tableposition = 1

for i, v in pairs (Sand:GetChildren()) do
    if v:IsA("BasePart") then
        table.insert(TouchableParts, tableposition, v)
        tableposition = tableposition + 1
    end
    wait()
end

for i, v in pairs (TouchableParts) do
    v:Touched:Connect(function(hit)
        local player = game.Players:GetPlayerFromCharacter(hit.Parent)
        if player then
           game.ReplicatedStorage.GravityController.disabled = false
        end
    end)
end

2 answers

Log in to vote
1
Answered by 4 years ago

Change line 25 to this:

v.Touched:Connect(function(hit)

Maybe it was my error from yesterday when I answered your question. it's v.Touched and not v:Touched (the dot)

0
Thanks. oh and btw I found out I shouldn't destroy the script instead I should just disable it Nistrict 44 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

I assume that Touched, in this case, is a property of TouchableParts[v], so try replacing the colon with a period.

-- Replace
v:Touched:Connect(function(hit)

-- with
v.Touched:Connect(function(hit)

Answer this question