Ad
Log in to vote
0

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

Asked by 2 months ago
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

Log in to vote
0
Answered by 2 months ago

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

0
nothing in console. SyndicateHalo 35 — 2mo
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. asdfasdf -2 — 2mo
0
I am trying to do this SyndicateHalo 35 — 2mo
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 SyndicateHalo 35 — 2mo
View all comments (7 more)
0
Try adjusting your function to use the ContextActionService. The current method you're using isn't recommended and might cause issues. asdfasdf -2 — 2mo
0
its works fully in testing mode though, and nothing is wrong with it until i use it in-game SyndicateHalo 35 — 2mo
0
also, I forgot to mention but my remoteevent is inside serverscriptservice SyndicateHalo 35 — 2mo
0
also, I forgot to mention but my remoteevent is inside serverscriptservice SyndicateHalo 35 — 2mo
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. asdfasdf -2 — 2mo
0
where do I place it then? replicated storage? SyndicateHalo 35 — 2mo
0
That's where I put mine, yeah. asdfasdf -2 — 2mo
Ad

Answer this question



Ad