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

How do i fix 19:52:21.443 - Touched is not a valid member of Script?

Asked by 5 years ago

My Script

script.Parent.Touched:Connect(function(hit)
    local char = hit.Parent
    local hum = char:FindFirstChild("Humanoid")
    if hum and char.Name ~= script.Parent.Parent.Name then
        hum.Health = hum.Health - script.Dmg.Value
        script.Disabled = true
        wait(.5)
        script.Disabled = false
    end
end)

The error

19:52:19.815 - LocalizationService.RobloxLocaleId overridden to "en-us" (x2)
19:52:21.443 - Touched is not a valid member of Script      ---- this the error
19:52:21.444 - Stack Begin
19:52:21.445 - Script 'ServerScriptService.Punch.DmgScript', Line 1
19:52:21.445 - Stack End

1 answer

Log in to vote
1
Answered by 5 years ago

touched is a thing that only works in parts, To your error it says you were trying to add touched to a script. Scripts do not exist so therefore cannot be touched. It would be better if you defined it or at least right out your blocks

0
ok thx i under stand lord_lol123 3 — 5y
Ad

Answer this question