Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

script only works in studio and not the actual game?

Asked by 7 years ago
Edited 7 years ago
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)
0
Shouldn't work in studio either since you have an extra end. hiimgoodpack 2009 — 7y
0
wheres the extra end? i cant find it anywhere kevinliwu1 9 — 7y
1
You'd find it if you indented properly................................................. hiimgoodpack 2009 — 7y
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 kevinliwu1 9 — 7y
View all comments (9 more)
0
also im pretty sure i did do the indenting wrong so that was my bad kevinliwu1 9 — 7y
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. ShadowOfCrimson 27 — 7y
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 kevinliwu1 9 — 7y
0
of course dere is no extra end because he removed it in an edit hiimgoodpack 2009 — 7y
0
lol hiimgoodpack i just fixed my indenting kevinliwu1 9 — 7y
0
there i made it back to when you though i had an extra end kevinliwu1 9 — 7y
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? kevinliwu1 9 — 7y
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. hiimgoodpack 2009 — 7y
0
edited 1 hour ago.... i just reverted it back to before i did anything with it LOL... kevinliwu1 9 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

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.

Ad

Answer this question