i made script that will increase Ysize of part every time until Ysize goes 73. but it doesnt works, how to fix that?
local water = workspace.map.WATER
if game.StarterGui.time.meow.Value == 2 then
repeat
wait(0.1)
water.Size = Vector3.new(water.Size.X, water.Size.Y + 0.5, water.Size.Z)
until
water.Size==Vector3.new(water.Size.X, 73.5,water.Size.Z)
end
local water = script.Parent
if game.StarterGui.time.meow.Value == 2 then
repeat
task.wait(.1)
water.Size = Vector3.new(water.Size.X, water.Size.Y + 0.5, water.Size.Z)
until water.Size.Y == 73.5
end
local part = script.Parent
part.Touched:Connect(function(hit)
local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
if player.PlayerGui.time.meow.Value == 2 then
-- rest of the code here --
end
end)
Or try using Remote Event. If you know how this works.
I have just tested this code, it actually works perfectly fine. It increases the height of the part and stops when it reaches 73.5 studs (on the Y axis).
Are you sure the script isn’t disabled? What kind of script are you using (local or server script)? Where is the script located? Have you tried switching the current part for “water” to a different part?
You didn’t even explain when you want it to change also you shouldn’t access StarterGui but instead PlayerGui. From what I’ve read people pretty much already solved your issue. It’s just that you either didn’t even try to implement any of these or don’t know how to.
local PS = game:GetService("Players")
local water = script.Parent
water.Touched:Connect(function(toucher: BasePart)
local model: Model = toucher:FindFirstAncestorWhichIsA("Model")
local player: Player = PS:GetPlayerFromCharacter(model)
if player then
local meow = player.PlayerGui.time.meow
warn(meow.Value)
if meow and meow.Value == 2 then
repeat
warn("moving!")
task.wait(.1)
water.Size = Vector3.new(water.Size.X, water.Size.Y + 0.5, water.Size.Z)
until water.Size.Y == 73.5
warn("ended moving")
end
end
end)