Ad
Log in to vote
0

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

Asked by 3 days 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!

Hi.

Looks like you're using an ad blocker.

That's fine...

No, it really is.

Just, I mean, we put a lot of work into this site, you know?

It would be really really appreciated if you would turn off your ad blocker for our website...

We tried really hard to make our ads as unobtrusive as possible.

If you really hate ads, would you consider a $2 donation via Patreon?

Here's the link.

We love you. We hope you love us too.

.

..

...

Now back to your regularly scheduled Scripting Helpers....

...

..

.

1 answer

Log in to vote
0
Answered by 3 days ago

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

0
nothing in console. SyndicateHalo 40 — 3d
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 — 3d
0
I am trying to do this SyndicateHalo 40 — 3d
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 40 — 3d
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 — 3d
0
its works fully in testing mode though, and nothing is wrong with it until i use it in-game SyndicateHalo 40 — 3d
0
also, I forgot to mention but my remoteevent is inside serverscriptservice SyndicateHalo 40 — 3d
0
also, I forgot to mention but my remoteevent is inside serverscriptservice SyndicateHalo 40 — 3d
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 — 3d
0
where do I place it then? replicated storage? SyndicateHalo 40 — 3d
0
That's where I put mine, yeah. asdfasdf -2 — 3d
Ad

Answer this question



Ad