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

RemoteEvent is not valid member of tool?

Asked by
CjayPlyz 643 Moderation Voter
5 years ago
Edited 5 years ago
local p = game.Players.LocalPlayer
local m = p:GetMouse()
local t = script.Parent
local r = script.Parent.RemoteEvent 

local function a ()
    local t = m.Target
    r:FireServer(t)
end

t.Activated:Connect(a)

Error on line 4, Client/Server side shows the RemoteEvent inside the tool.

EDIT : It's a LocalScript.. obviously and it is inside the tool.. obviously.

0
Where is the script located? Spjureeedd 385 — 5y
0
its a localscript inside the tool CjayPlyz 643 — 5y
1
after testing your script I have came across two issues. the first is if your testing in solo mode inside the studio your localscript will throw an error if its immediately enabled. however if you disable the localscript, then after your character loads enable the localscript, it will then not throw an error. the other problem is your function will not activate the remote event. im not sure why t mantorok4866 201 — 5y
0
that's.. wrong CjayPlyz 643 — 5y
0
but good effort.. CjayPlyz 643 — 5y

1 answer

Log in to vote
5
Answered by 5 years ago

It's probably not existed at that time so do

local r = script.Parent:WaitForChild("RemoteEvent")
0
I can't believe i didn't tried this sooner... CjayPlyz 643 — 5y
Ad

Answer this question