I am having trouble with my scripts. Here they are:
This is the script that is placed in the Button the player clicks:
local player = game.Players.LocalPlayer
wait()
local leaderboard = player.leaderstats
local button = script.Parent
local price = button:WaitForChild("Price")
local mesh = button:WaitForChild("MeshName")
button.MouseButton1Click:Connect(function()
if leaderboard.Level.Value >= price.Value then
game.ReplicatedStorage.MeshEvents.ChangeMeshSquare:FireServer(player.Name, mesh)
end
end)
This is the script that is placed in ServerScriptService:
game.ReplicatedStorage.MeshEvents.ChangeMeshSquare.OnServerEvent:Connect(function(player, mesh)
if workspace:FindFirstChild(player.Name) then
print("found")
if workspace[player.Name]:FindFirstChild("Torso") then
workspace[player.Name].Torso.Mesh.MeshId = MeshId.new("1171241994")
workspace[player.Name].Torso.Mesh.Scale = Scale.new("0.02, 0.02, 0.02")
end
end
end)
And The Remote Event is named "ChangeMeshSquare" in ReplicatedStorage. Idk where I went wrong I think it is the way I accessed the Mesh inside the player torso.
(The player is custom so StarterCharacter in StarterPlayer
