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

Question about remote events?

Why is this not working? A lot of the remote events I did a few months ago don't do anything now.

The fire.on the localscript

uis.InputBegan:connect(function(input,process)
if not process and input.KeyCode == Enum.KeyCode.Z then
script.Parent.Event:FireServer()
end
end)

The normal script.

script.Parent.Event.OnServerEvent:Connect(function(player)
print "z"
end)

Nothing happens at all when I press z.

5 comments

0

Place the script in ServerScriptService, and the local script in StarterPlayerScripts

0

I can't put the script in ServerScriptService because the event it is listening for is an individual players ability.

0

put local uis = game:GetService("UserInputService")

0

also if this is in replicatedstorage.. it wont run

1 answer

Put the remote event in Replicated Storage, put the script in ServerScriptService, and put the local script in starterplayerscripts. Then replace the scripts with these fire.on in local:

uis.InputBegan:connect(function(input,process)
if not process and input.KeyCode == Enum.KeyCode.Z then
game.ReplicatedStorage.Event:FireServer()
end
end)

normal script:

game.ReplicatedStorage.Event..OnServerEvent:Connect(function(player)
print "z"
end)

Accept this answer if it helped you.

1 comment

0

wrong event..OnServerEvent does nothing

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