Can’t get players name from ui. I can use ui with my name (BerkeCavdaroglu’s Car) But others can’t use it.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried to look but i couldn’t find. And I am also new to scripting nearly idk anything about lua.I can write this by knowing a little of C#
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
-- This is an example Lua code block
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.
Whilst you should make a system using remote events which would be much more efficient and reliable you could make your script like this:
Please note this will only work if this GUI is in the PlayerGui child of a player object
local db = false
function leftClick()
print("click")
local plr = script.Parent.Parent.Parent.Parent.Parent --// goes up through the
--//hierarchy(filltank/Frame/GiveUI/PlayerGui/Player Object)
db = true
workspace[plr.Name.."'s Car"].Fuel.Value = 50
db = false
end
script.Parent.MouseButton1Click:Connect(leftClick)
Whilst this should work it is not reliable and would need constant changes as you edit your game through it’s lifetime if you changed your car system etc
I’m sorry, I’m just here to assist others from their problems. I got his point and decides to fix that. I only came here to help not to perform an assertion. My bad
By the way in Xacima’s solution, BerkeCavdaroglu. You can also use this method If you chose it to run in server, use remote event and to make this function you’ll have to utilize a local script and trigger / fire it inside a localscript.