Highlighted part, and I was making a script were it would change the transparency, and change the bool value to false. Let me share it so it can make more sense.
this is the Server Script were i change the properties (I believe this is were the issue is)
local barr = game.Workspace["Scary Lary"]
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local SLA = ReplicatedStorage:WaitForChild("ScaryLaryACTIVATED")
SLA.OnServerEvent:Connect(function()
barr.Cancollide = false
barr.Transparency = 0.5
end)
this is the local script:
local barr = game.Workspace["Scary Lary"]
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local SLA = ReplicatedStorage:WaitForChild("ScaryLaryACTIVATED")
game.Players.PlayerAdded:Connect(function(Plr)
Plr.Chatted:Connect(function(msg)
if Plr.UserId == "309099401" then
if msg == "Le traître se noie" then
SLA:FireServer()
end
end
end)
end)
I don’t know why its running, I’m trying to make it so everyone sees the part change properties when someone says something
Expected outcome when they say the word(properties change):
Sorry, there is a lot of typos, Here is the problem since its hard to read because of the typos:
I’m connecting everything through a remote function so everyone can see the part when they say the word
If you want it to happen on the client only then do this:
Local Script:
local barr = game.Workspace["Scary Lary"]
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local SLA = ReplicatedStorage:WaitForChild("ScaryLaryACTIVATED")
SLA.OnClientEvent:Connect(function()
barr.CanCollide = false
barr.Transparency = 0.5
end)
Server Script:
local barr = game.Workspace["Scary Lary"]
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local SLA = ReplicatedStorage:WaitForChild("ScaryLaryACTIVATED")
game.Players.PlayerAdded:Connect(function(Plr)
Plr.Chatted:Connect(function(msg)
if Plr.UserId == "309099401" then
if msg == "Le traître se noie" then
SLA:FireClient()
end
end
end)
end)
@PinnacleFusion If you want it to happen on server, then try this:
Server Script in ServerScriptService
local Players = game:GetService("Players")
local cache = {}
function getUsernameFromUserId(userId)
if cache[userId] then return cache[userId] end
local player = Players:GetPlayerByUserId(userId)
if player then
cache[userId] = player.Name
return player.Name
end
local name
pcall(function ()
name = Players:GetNameFromUserIdAsync(userId)
end)
cache[userId] = name
return name
end
local barr = game.Workspace["Scary Lary"]
game.Players.PlayerAdded:Connect(function(Plr)
Plr.Chatted:Connect(function(msg)
if Plr.UserId == 309099401 and getUsernameFromUserId(309099401) == Plr.Name then
if msg == "Le traître se noie" then
barr.CanCollide = false
barr.Transparency = 0.5
end
end
end)
end)
Reminder: You can’t use string for UserId, it returns an IntValue. lol
I would not recommend the way you’re doing it right now. Since you’re ONLY going off a remote event, an exploiter can easily just fire the event and not have to worry about it.
Instead, what you should do is move the LocalScript onto the server. On the server, when a player joins, connect the .Chatted event, and if they match the text, and have the specified UserId, then change the properties. The Event firing from the client is a useless middleman, and can also cause security issues.
No, the client isn’t allowed to change the player name, but I don’t see how it’s relevant to the post anyways.
Correction: Yes, most exploits are able to change protected strings such as UserId, or Name, but the client will not be able to change these protected strings if run on a LocalScript, and not in an exploit.