Jump to content

Creating Elements (Vehicles) for each player only


DriFtyZ

Recommended Posts

hello community i started making a car shop scripting where when a player hits a marker it opens up a gui menu where he can select which he wants to buy, BUT when he selects a specific car on the list i made it to spawn inside the carshop to see how it look like is(preview car)... the thing is the vehicle that is created is not locally which means all the players can see it any ideas how to create and remove elements only for localPlayer?  

Link to comment

You probably have something like this (if it's a client-only script, as it should be):

local marker = createMaker(...)

addEventHandler("onClientMarkerHit", marker, function()
    
    guiSetVisible(....)
    createVehicle(....)
    
end)

Change it to this:

local marker = createMaker(...)

addEventHandler("onClientMarkerHit", marker, function(player, dim)
    
    if player == localPlayer and dim then
      guiSetVisible(....)
      createVehicle(....)
    end
    
end)

If it doesn't look like that and you trigger an event from the server-side, show us your code.

Link to comment

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.
×
×
  • Create New...