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

Why isn't my RemoteEvent working?

I have a RemoteEvent in ReplicatedStorage and in ServerScriptStorage I have a script running this:

local InputImageLibrary = require(408470686)

local event = game.ReplicatedStorage.indicatorEvent
print(event.Name)

event.onServerConnect:connect(function(player)
	local playerGui = player:WaitForChild("PlayerGui")
	local frame = playerGui.Shop.Frame		
	
	local Y = InputImageLibrary:GetImageLabel(Enum.KeyCode.ButtonY, "Dark")
	Y.Name = "yIndicator"
	Y.Parent = frame
	Y.Size = UDim2.new(0.19,0,0.1,0)
	Y.Position = UDim2.new(.81,0,0,0)
	
	while true do
		Y:TweenPosition(UDim2.new(1,10,0,0), "Out", "Elastic", 2, true)
		wait(10)
		Y:TweenPosition(UDim2.new(.81,0,0,0), "In", "Quad", .3, true)
		wait(3)
	end
end)

And in a LocalScript in the StarterGui I have:

if game:GetService("UserInputService").GamepadEnabled then
	print("gamepad enabled")
	game.ReplicatedStorage:WaitForChild("indicatorEvent"):FireServer()
end

Am I missing something? I followed the wiki and a couple other tutorials and It just doesn't seem to work for some reason.

Thank you in advance for any help.

1 answer

✓ Accepted answer

According to the Roblox API, the server event is named onServerEvent, not onServerConnect. Also, try firing your event with the proper arguments.

1 comment

0

Thank you! This was an error, but the main error was that I had accidentally disabled the script. It works wonderfully now.

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