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

trying to make a script but keeps saying connect is not valid member of part anyone know?

Asked by
danglt 185
6 years ago

local Gamepass = 122313

local Player = game.Players.LocalPlayer

function onTouched(m) p = m.Parent:findFirstChild("Humanoid") if p ~= nil and game.MarketplaceService:PlayerOwnsAsset(Player,Gamepass) then p.LowerTorso.CFrame = CFrame.new(0,8,9) end end script.Parent:connect(onTouched)

0
Can you correctly put your code in a code block please? User#21908 42 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

You are trying to call "connect" on an instance, not an event.

Instead of:

script.Parent:connect(onTouched)

do

script.Parent.PUT_EVENT_CALL_HERE:connect(onTouched)

-- For example:
-- script.Parent.OnServerEvent:connect(onTouched) (if RemoteEvent in a Server Script)
0
My apologies, meant "PUT_EVENT_LISTENER_HERE". Julian_Orteil 48 — 6y
0
exuse me but im not that advanced on scripting so im not sure what to put as a listener danglt 185 — 6y
Ad

Answer this question