Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

why transparency not changing ?

Asked by
tacotown2 119
5 years ago
--- local script
local remote = game.ReplicatedStorage.Effect1

if game.Players.LocalPlayer.PlayerGui.Waitmove:WaitForChild("Logia") then
    print("Yah")
   remote:FireServer()
print("Yah1")
end

-- server
local remote = game.ReplicatedStorage.Effect1

remote.OnServerEvent:Connect(function()
game.Players.PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:Connect(function(char)
        local arm1 = char["Right Arm"]

        arm1.Touched:Connect(function(hit)
            if hit then
                arm1.Transparency = 0.5

               end
           end)    
       end)
end)
end)

it prints Yah and Yah1 but transparency doesnt change pls help me lol

0
Mind if you put prints at the remote? Tell me after that if it prints. Qariter 110 — 5y
0
i tryed to print after the transparency part and diddnt work tacotown2 119 — 5y
0
Is your character R15 or R6 Qariter 110 — 5y
0
Tried using WaitForChild? Amiaa16 3227 — 5y
View all comments (2 more)
0
I just noticed you don't need player added and character added in your OnServerEvent because the player value is a parameter of OnServerEvent. In the () just put plr or player as a parameter, and for the character, just use plr.Character or whatever you have as the player parameter. ScrubSadmir 200 — 5y
0
watch alvin blox with rainbow trail i think you need to specify the arm by using char.Player or something AnotherPerson_999 28 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

Your script is not working as you are not running the code until a player joins the game. When a player fires (or invokes) a remote event or remote function, the first argument of the callback is the player.

Example:

local ReplicatedStorage = game:GetService("ReplicatedStorage");
local RemoteEvent = ReplicatedStorage:WaitForChild("RemoteEvent");

RemoteEvent.OnServerEvent:Connect(function(player)
    -- "player" is the player who fired the remote
    print(player.Name, "just invoked a remote event in ReplicatedStorage :OO")
end)
Ad

Answer this question