I’ve never heard of these before… May you elaborate please?
like Player:SetAttribute("Team", "Team1")
to set the attribute and Player:GetAttribute("Team")
to get the value set. In this case that value would be “Team1”
same problem as before, whenever the attribute is passed to the server, it returns back to it’s original state
edit: i do like the idea of using attributes more though, very cool
Are you setting the attribute from only one location?
set here
local plr = game:GetService("Players").LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
plr:SetAttribute("Team", "Booking")
then passed to the server here
local plr = game:GetService("Players").LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
game:GetService("ReplicatedStorage").LoadCharacter:FireServer(plr)
end)
then the player gets teamed on the server here
game:GetService("ReplicatedStorage").LoadCharacter.OnServerEvent:Connect(function(plr)
print(plr:GetAttribute("Team"))
plr.Team = plr:GetAttribute("Team")
end)
That’s because the attribute is set locally so the server cant see anything.
–Firing
script.Parent.MouseButton1Click:Connect(function()
game:GetService("ReplicatedStorage").LoadCharacter:FireServer(plr:GetAttribute("Team"))
end)
For the server use the code I gave you before for switching teams because it will now pass a string
oh yea i forgot about that ;;
didn’t seem to change anything tho?
Can you print the attribute on the client before you send it and when you receive it on the server?
i already did that
top one is changing it, second one is sending and bottom one is recieving
If the server changes the value it sees, it will replicate to the client. Therefore if you change the value on the client before that happens, the server will overwrite it with its version of the value.
Sorry mb I forgot you sent a screenshot previously. Can you show the updated server code? Is it similar to what I was referencing? Because if the client prints the value showing it exists idk why the server wouldn’t be able to see it (Sorry in advance for the repetition)
here it is. idk either
game:GetService("ReplicatedStorage").LoadCharacter.OnServerEvent:Connect(function(plr)
plr.Team = plr:GetAttribute("Team")
end)
I just said you cant get the attribute from the player
–Server
game:GetService("ReplicatedStorage").LoadCharacter.OnServerEvent:Connect(function(plr, Team)
plr.Team = game:GetService("Teams"):FindFirstChild(Team)
end)
–Client
script.Parent.MouseButton1Click:Connect(function()
game:GetService("ReplicatedStorage").LoadCharacter:FireServer(plr:GetAttribute("Team"))
end)
i dont even know exactly what i did, but it’s working now lol
Mark your post as the solution so this forum doesn’t stay live for eternity!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.