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

Remote Event not functioning properly?

My first script detects a change in an int value's value. When the value becomes 0, it fires a remote event to the client. Server script:

script.Parent:GetPropertyChangedSignal("Value"):Connect(function()
	print(script.Parent.Value)
	local val = script.Parent.Value
	if val == 0 then
		print"is 0"
		game.ReplicatedStorage.RemoteEvent:FireAllClients()
		print("fired")
	end
end)

The problem is, is that it doesn't fire the event. Here's my local script:

game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function()
	print("finally")
	local plr = game:GetService("Players").LocalPlayer
	local char = plr.Character
	script.Parent.Value = 10
	char.Humanoid.WalkSpeed = 0
	wait(.5)
	char:MoveTo(Vector3.new(-20.55, 19.9, -6.46))
	game.Workspace.Map1.Dots:Destroy()
	local ss = game:GetService("ServerStorage")
	local newdot = ss.Dots:Clone()
	newdot.Parent = game.Workspace.Map1
	wait(4.4)
	char.Humanoid.WalkSpeed = 16
end)

I have no clue why this doesn't work.

1 comment

0

Add a print statement in global scope (i.e. at the top of the local script) and make sure it runs.

1 answer

✓ Accepted answer

The code looks solid, is your script in replicatedstorage, and is your localscript in replicatedstorage or workspace?

1 comment

0

My remote event is in replicated storage. My local script is in the intvalue in workspace. My script is also in the same int value. https://gyazo.com/1365179ee00d8ade6045a2adfbfc8e6f

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