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

Touched is not a valid member of Workspace?

Asked by 9 years ago

Im Trying to make a game called Boulder Run Where you run from a boulder and i want to make a message saying who has survived the boulder by touching this invisible brick

h = Instance.new("Hint", game.Workspace)

local db = false
function onTouched(hit)
    if hit.Parent == nil then Print ("gun") return end
    if db then return end
    db = true
    local pName = game.Players:GetPlayerFromCharacter(hit.Parent)
    print(pName)
    h.Text = pName 
    wait(5)
    msg:remove()
    db = false

end

script.Parent.Touched:connect(onTouched)
0
I copied this from wiki but It didnt work so I rewrote the entire script and made it almost entirely different I used the wiki as a Reference! :D dscpcheatsis10123 0 — 9y

1 answer

Log in to vote
1
Answered by
Merely 2122 Moderation Voter Community Moderator
9 years ago

You probably have the script placed in the Workspace. That's why it's telling you that "Touched" is not a member of Workspace. You should place the script inside a part.

Ad

Answer this question