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

script works in test mode but not when i play game?

mouse.KeyDown:connect(function (key)
	local key = string.lower(key)
	if string.byte(key) == 48 then
		local keyConnection = mouse.KeyUp:connect(function (key)
			if string.byte(key) == 48 then
				if used == false then
				used = true -- Run function
	Remote.RemoteEvent:FireServer()
	used = true
			for i = 1,5 do
			game.Workspace.CurrentCamera.FieldOfView = (70+(i*2))
			wait()
			end
			script.Parent.Boost.Whole.Fill:TweenSize(UDim2.new(0, 0,1, 0),"Out","Quad",5)
		script.Parent.Boost.Whole.Fill.Text = " "
			wait(5)
			for i = 1,5 do
			game.Workspace.CurrentCamera.FieldOfView = (80-(i*2))
			wait()
			end
			wait(3)
				script.Parent.Boost.Whole:TweenPosition(UDim2.new(.25,0,3,0),"Out","Quad",3.5)
			wait(3)
	script:Destroy()
	end
		end
		end)
	end
end)

Its not working! it works fine in studio but when I play in game nothing happens at all!

1 answer

Please check the Developer Console in-game with F9 for any errors.

11 comments

0

nothing in console.

0

May I ask what you are trying to do? And if you could give reference as to where your remote event is and what function is being triggered by that.

0

I am trying to do this

0

Ignore above comment, I am trying to make the players walkspeed doublefor 5 seconds, meanwhile, a bar goes down and then the players walkspeed is back to 16

0

Try adjusting your function to use the ContextActionService. The current method you're using isn't recommended and might cause issues.

0

its works fully in testing mode though, and nothing is wrong with it until i use it in-game

0

also, I forgot to mention but my remoteevent is inside serverscriptservice

0

also, I forgot to mention but my remoteevent is inside serverscriptservice

0

It most likely doesn't work because you're trying to access your remote event from a localscript. Your event is in ServerScriptService, which is not replicated on the client and therefore the client has no access to it.

0

where do I place it then? replicated storage?

0

That's where I put mine, yeah.

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