Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

RemoteEvent is not valid member of tool?

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.

5 comments

0

Where is the script located?

0

its a localscript inside the tool

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

0

that's.. wrong

0

but good effort..

1 answer

✓ Accepted answer

It's probably not existed at that time so do

local r = script.Parent:WaitForChild("RemoteEvent")

1 comment

0

I can't believe i didn't tried this sooner...

This discussion is preserved as it was. New answers, comments, and votes are closed.