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

script only works in studio and not the actual game?

local debounce = false

game.ReplicatedStorage.BindableFunctions.MoveWeights.OnInvoke = function()
	local weight = script.Parent
	if debounce == true then return end
		if debounce == false then debounce = true
		for i = 1,15 do
			wait()
			weight:TranslateBy(Vector3.new(0,0.125,0.125))
		end
			for i = 1,15 do
				wait()
				weight:TranslateBy(Vector3.new(0,-0.125,-0.125))
			end
		debounce = false
	end
end

so this script is controlled with a bindable function that is connected to a local script but for whatever reason whenever i test it in studio mode it works but whenever i test it in the actual game it doesn't and I cant figure out why? Also there are no errors popping up in the output bar

This is the local script that the above script is connected to:

script.Parent.Equipped:Connect(function(mouse)
	mouse.Button1Down:Connect(function()
		game.ReplicatedStorage.BindableFunctions.MoveWeights:Invoke()
	end)
end)

13 comments

0

Shouldn't work in studio either since you have an extra end.

0

wheres the extra end? i cant find it anywhere

1

You'd find it if you indented properly.................................................

0

well this script works in studio and no errors show there is an extra end in the output so I dont think thats the problem

0

also im pretty sure i did do the indenting wrong so that was my bad

1

There is no extra end, the one you're looking for is included in the same line as the if statement. As for most debugging I find it helpful to include print commands throughout to see which things are firing and which are not.

0

i did what you said and it seems that its from the local script, however i can't really find anything wrong with it

0

of course dere is no extra end because he removed it in an edit

0

lol hiimgoodpack i just fixed my indenting

0

there i made it back to when you though i had an extra end

0

and dont bother commenting when you're not gonna help, i even said no errors popped up in the output so how can there be an extra end?

0

"Write your answer here. If you are not posting an explanation, please use comments instead!" It's called a suggestion, not an answer. Also, you did not fix your indenting.

0

edited 1 hour ago.... i just reverted it back to before i did anything with it LOL...

1 answer

for anyone who might have the same problem like mine, its because i used a bindable function for server-client communication, to fix it, instead of using bindable functions, use remote functions.

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