You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? I want to make if the Player click the button, called claim (script.Parent), it will print his name, and show the username on a textlabel on a screen.
What is the issue? I tried a lot of ways, to get it (Remote events) and ecc.
What solutions have you tried so far? I tried to use the PlayerAdded function, but it doesn’t work, and if I don’t use it, the console print: name is nil (player.Name).
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!
script.Parent.MouseButton1Click:Connect(function(player)
local OrderNumber = script.Parent.Parent.Name
local order = script.Parent.Parent
if order.Claimed.Visible == true then return end
script.Parent.Text = "Complete"
local claim = Instance.new("BoolValue")
claim.Name = "hasClaimedOrder"
claim.Parent = player
order.Claimed.Visible = true
order.claimeduser.Text = "Claimed by: " .. player.Name -- error "name is nil"
order.Claimed.UserWhoClaimed.Value = player.Name -- error "name is nil"
script.Parent.check.Value = false
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.
if script:IsA("Script") then script.RunContext = Enum.RunContext.Client end
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
local OrderNumber = script.Parent.Parent.Name
local order = script.Parent.Parent
if order.Claimed.Visible then return end
script.Parent.Text = "Complete"
local claim = Instance.new("BoolValue")
claim.Name = "hasClaimedOrder"
claim.Parent = player
order.Claimed.Visible = true
order.claimeduser.Text = `Claimed by: {player.Name}` -- error "name is nil"
order.Claimed.UserWhoClaimed.Value = player.Name -- error "name is nil"
script.Parent.check.Value = false
end)
Yeah, the thing is: .MouseButton1Click does not return any parameters meaning player was nil. But now you would want to run the non-gui code through the server using a RemoteEvent.
Local Script
local plr = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
game.ReplicatedStorage.McOrderSystem["Getting info"]:FireServer(plr)
end)
Uh? Are you sure about that? I’ve left a LocalScript in a folder of mine in the workspace for a small shop system and it been working just fine. Unless there’s some really specific things related to that that I dont know about since I’ve basically just started