#brick color change client side

1 messages · Page 1 of 1 (latest)

vital garnet
#

can someone help me when brickcolor change it happens to all clients I want it to happen individual that touched the brick

viscid bolt
#

Make it a local script then

#

Also put the local script in StarterGui/StarterCharacterScripts/StarterPlayerScripts

#

Dont put it in wirkspace

#

As local scripts doesnt works in workspace

#

They only work when related to player

#

Or in a player/character

vital garnet
tardy cobalt
#

as local scripts usually dont work in workspace or tend to be unreliable

vital garnet
tardy cobalt
#

yeah

vital garnet
tardy cobalt
#

@vital garnet

chilly sigil
# vital garnet didn't work at all

you have to change up the script im assuming you have it in the part you touch so it wont work just moving it to starterplayerscripts you need to also move the code into a client script on roblox is LocalScript but client script makes more sense anyways after that you put it in starterplayerscripts and you have to redo the code to work from there not from inside the part itself

vital garnet
# tardy cobalt show the script and explorer

-- Put this script inside the part you want to change color
local TweenService = game:GetService("TweenService")
local Players = game:GetService("Players")

local part = script.Parent
local originalColor = part.Color
local touchedColor = Color3.fromRGB(42, 255, 42) -- Lime green
local hasTouched = {}

local function onTouch(hit)
local character = hit.Parent
local player = Players:GetPlayerFromCharacter(character)

if player and not hasTouched[player.UserId] then
    hasTouched[player.UserId] = true

    -- Change color for this player only
    local originalColor = part.Color
    part.Color = touchedColor

    -- Create effect
    local effectPart = Instance.new("Part")
    effectPart.Size = part.Size
    effectPart.CFrame = part.CFrame
    effectPart.Anchored = true
    effectPart.CanCollide = false
    effectPart.Transparency = 0.6
    effectPart.Material = Enum.Material.Neon
    effectPart.Color = touchedColor
    effectPart.Parent = workspace

    local goalSize = part.Size + Vector3.new(6, 0, 6)
    local tweenInfo = TweenInfo.new(0.6, Enum.EasingStyle.Quint, Enum.EasingDirection.Out)

    local tween = TweenService:Create(effectPart, tweenInfo, {Size = goalSize})
    tween:Play()

    tween.Completed:Connect(function()
        local fadeTween = TweenService:Create(effectPart, TweenInfo.new(0.3), {Transparency = 1})
        fadeTween:Play()
        fadeTween.Completed:Connect(function()
            effectPart:Destroy()
        end)
    end)
end

end

part.Touched:Connect(onTouch)

Players.PlayerRemoving:Connect(function(player)
hasTouched[player.UserId] = nil
end)

tardy cobalt
vital garnet
coral ruinBOT
#

studio** You are now Level 1! **studio

vital garnet