Is it possible to change startercharacterscripts based on a player's team?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve?
    I want to have players on certain teams bleed different colors rather than the everyone having the same color of blood.
  2. What is the issue?
    I’ve been messing around with a blood splatter script that is placed in StarterCharacterScripts and when I try to make it find a player’s team or determine whether or not a player is on a certain team it just doesn’t work.
  3. What solutions have you tried so far?
    I’ve looked at a few posts regarding team based characteristics for players, but they don’t seem to cover the topic of startercharacterscripts or starterplayerscripts.

I’m not very proficient at scripting, so I could be doing something wrong but here is what I’ve tried–

local players = game:GetService("Players")
local teams = game:GetService("Teams")
local function onPlayerAdded(player)


if player.Team == teams["blah"] then
--rest of blood splatter script would go here and I would change the decals according to team i.e. if purple team then their decal ids would be different than the default decal ids for example. 

end

You can try putting the script into startercharscripts, put an IntValue inside the starterscript for the script to use instead of just the decal id, then change the value using something like this or just from the starterscript itself:

player.CharacterAdded:Connect(function(character)
if character:FindFirstChild("thatcharacterscript") then
local decalvalue = character:FindFirstChild("thatcharacterscript"):FindFirstChild("DECALID")
if player.Team == teams["blah"] then
decalvalue.Value = yourvaluehere
elseif player.Team == teams["blahblah"] then
decalvalue.Value = theothervaluehere
end
end
end)
1 Like