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

Have a model transparent for one player only?

Asked by 4 years ago

I want to have it when some player clicks buy on a SurfaceGui. When the player clicks it, if they have enough coins to buy it then the Model becomes Transparent and CanCollide becomes false, but only for that one player. This is what I have so far, but I don't know how to do the transparent and the canCollide thing:

script.Parent.MouseButton1Down:Connect(function(plr)
    local coins = plr.leaderstats.Coins
    local price = script.Parent.Parent.Parent.Price
    if coins.Value >= price.Value then
        coins.Value = coins.Value - price.Value
    end
end)

This script is a normal script.

The model is in workspace, in a folder "Levels", in a model "Farm1", and the model I want to have transparent and canCollide false is in that model. The models name is "Doorway".

0
Use a localscript. NewGPU 36 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Use local script to work

local Model = workspace.Part --Model = Your Model
script.Parent.MouseButton1Down:Connect(function()
        local plr = game.Players.LocalPlayer
        local coins = plr.leaderstats.Coins
        local price = script.Parent.Parent.Parent.Price
        if coins.Value >= price.Value then
            coins.Value = coins.Value - price.Value
            Model.Transparency = 1
            Model.CanCollide = false
            Model.Anchored = true --without this line, the model will disappear
        end
    end)

you will have to add a remote event so that other players can see that there has been a change in value

0
I need the model to be transparent for only that one player TomasGoldFinch 7 — 4y
0
This I did. test with more players to see what works TheMaleWhale_png 82 — 4y
Ad

Answer this question