Skraund

[HELP] Script

Recommended Posts

Hello, I created a function that changes the color of the square from white to black on command. But I had a problem, the color should change only for the player who entered it, and it changes for all players on the server, how can I fix it?
Event handler:

addEventHandler( "onClientHUDRender", getRootElement(), d ) 

Share this post


Link to post

I need to see more code in order to be able to point out the problem.

Share this post


Link to post
addCommandHandler("commandname", 
    function(player, cmd)
        --trigger some event to client with player variable
    end
)

You can get the player who entered it by using this

Share this post


Link to post

You're probably running the event for all clients, make sure you only forward the client that issues the command using the example provided above.

Share this post


Link to post

I think you trigger events with getRootElement() server-side. If you use triggerServerEvent("someEvent",root,args) your local player here is source. BUT if you trigger client use this: triggerClientEvent("some_client_event", root, args). If you use getRootElement() instead of root , it will trigger for ALL player. Make sure u read wiki properly ^_^

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.